New TwitterOAuth PHP library release



The TwitterOAuth PHP library has been under active development over the last couple of months and a significant number of improvements and new features have been added. If you haven’t taken a look recently now might be a good time to take a second look and update any implementations.

New features

  • Fancy documentation site with live examples
  • Composer support and packagist listing
  • Continuous Integration tests
  • Media upload support
  • New ->oauth and ->url methods
  • Application bearer token support
  • General code improvements and PSR conformity

Planned features

  • Streaming API support
  • Live documentation improvements

While there are some planned improvements I would also love any feedback the community has.



Bumping this to the top. This is great! Thanks for the huge contribution to the community.



Thanks, @abraham - I know your library is extensively used across the PHP community, these are really great updates!


@abraham, this does not seem to work correctly with application authentication it’s like something to with the get method is changing or has the url layout changed?


A number of methods have changed. Be sure to follow through the documentation site. I is a live demo of using TwitterOAuth.


Big fan here - been using your library for over a year - going on 18 months now.

We from time to time seem to have an issue when Twitter servers are busy or down. It causes our scripts that use your library to hang (so to speak).

What does the “retry” switch do? Currently it is set to FALSE, but if it were TRUE, how does that effect things?

Love the library you built. A real lifesaver.

Using the Twitter (REST) API to obtain data through php?

It does nothing. The idea was if some sort of temporary server error was returned to automatically retry without the developer having to catch it.


OK good to know. Thanks.


I can’t find any documentation on bearer tokens.I would really love to use them since they have a higher rate limit.


See testOauth2Token and testBearerToken in the tests.


@abraham I will have an question relating to the retweet, I am using your AOuth which is written by you. I am need help in retweeting. Please guide me.


What have you tried and what’s not working about it?


Thanks @abraham I counter the error personally. Thanks again.


Good day sir! I stored the access token and access token secret to my database. Now, I want the user to automatically logged in using only their saved access token and access token secret. How can I do that? Please help. I’m new to this. Thanks!


Hello @abraham I have an question regarding tweet impression while I am using twitter api, our tweet impressions are very low. How can I encounter this?



Using twitteroauth to get an access token, and then get a home timeline, how do I then actually display the results in my web page? Nobody seems to tell you that part. When using web intents from twitter, you just put that a code in and the widget js does the rest. But I have this block of JSON from the api. Ok, great, now how do I make it look like a timeline on my page?


Using the API you’ll only get the raw JSON data - you need to write your own code or use a library to style the output for your website. Generally speaking, the easiest way to embed a timeline would be to use a Timeline widget from; you can also use the oEmbed endpoint to get back the HTML wrapped inside a JSON response; or, do all yourself in code (you should comply with the display requirements if you do so).


Thank you. Twitter does not put out a widget or library for displaying the API data? I need to use the API. Any recommendations for a library? I can’t find anything on this with internet searches.