Display PHP twitter feed as summary cards



I have installed the javascript twitter feed on my website, and it works well, but for SEO considerations i want to implement a pure-PHP twitter feed. I’ve found a few tools to help extract lists of tweets from the twitter api, and that’s all good and i can take the raw text feed and create hrefs for hashtags and links, but it doesn’t display the image/title/description from the linked webpage in a handy summary twitter card. And i haven’t found any suitable 3rd party tools to collect this information and display it like twitter does. I’ve seen the meta-codes to create summary cards, however the data to fill in the meta-codes (image/title/description from linked page) isn’t supplied by the twitter api.

Does anyone know of a nice “package” i can integrate that would do this sort of thing? Short of that, we’ll have to subscribe to http://embed.ly, pass the link from the tweet to their api and receive image/title/description in return, and then create the twitter card using the meta-codes for summary cards. I’m just hoping there is a more “open-source” way to do this instead of relying on a paid service like embed.ly. Seems like this would be a common request.



There’s no card data in the API, and displaying the cards would also require you to follow the Twitter display requirements so we would strong recommend that you use our widgets and embeds (which will also be updated for any display changes in the future without any need for custom work). That said you’re free to consume the API seperately if you choose.

I’d be curious to understand more about your SEO considerations or concerns?


is there a widget that is straight-PHP and doesn’t require Wordpress?


Twitter does not provide a web embed that is “straight-PHP” but you are welcome to use https://publish.twitter.com to generate embeddable HTML+JS code that you could include in your sites. There is no connection between that code and our Wordpress plugin.


ok, not sure why the image/title/description of linked articles are not sent through the API, the information is collected by twitter when someone posts a tweet.

so, does that mean the javascript twitter feed hits the website linked in each tweet as it displays them in the feed as ‘twitter summary cards’? or does the javascript twitter feed somehow collect that information through other means? I guess I could look through that code.

As for SEO, my SEO team wants the tweets embedded in the page source, so the javascript doesn’t satisfy our needs, hence the desire to have a PHP feed, which work ok, but it doesn’t show the image/title/description of the linked article, and thus has a lot less pizzazz. To get that info is costly, hence the desire to see that info in the API result.


Card data is not included in the Twitter API.

Twitter’s embedded timelines and embedded Tweets are able to include cards directly as they are based on the same technology used by the Twitter apps and website.

We strongly advise that you use the official embedded options available via publish.twitter.com as these already directly conform with Twitter’s Display Guidelines, they automatically update when those requirements change, and they do not require you to register a new Twitter app.

If you want to build your own, you will not have access to the card data (you’ll have to build your own solution if you want to display anything other than the text of the Tweet) and you will be subject to the API rate limits for reading Tweets and timelines.