The Twitter extension comes with a pre-configured connection class to use for making API calls to Twitter's v1.1 API.


Before you can leverage this extension you need to head to Settings > Extensions > Twitter Extension and enter your API credentials from

Getting Started

To get started you will need to resolve or inject the connection class into your code. The connection class will already be configured to your authentication settings. Below is an example of a basic Laravel command:

<?php namespace Anomaly\ExampleTheme\Command;

use Abraham\TwitterOAuth\TwitterOAuth;
use Anomaly\TwitterExtension\Twitter\TwitterConnection;

class GetRecentTweets

    public function handle(TwitterConnection $connection)
        /* @var TwitterOAuth $connection */
        $recent = $connection->get(
                'screen_name' => 'pyrocms',
                'include_rts' => false,
                'count'       => 10,

        return $recent;

Notice how the $connection is hinted as the TwitterOAuth class. This is because it's a wrapper for it. If you need to get the literal TwitterOAuth instance for any reason you can use getConnection:

$real = $connection->getConnection();

TwitterOAuth Documentation

For more information on available functionality please refer to the documentation for the package: