This plugin integrates the Abraham's TwitterOAuth library to Lithium (Li3).
This library requires https://github.com/abraham/twitteroauth
-
Install Abraham's Twitter OAuth library into
libraries/_source/twitteroauth
-
Symlink _source/twitteroauth/src to libraries/TwitterOAuth
-
To enable the library add the following to
app/config/bootstrap/libraries.php
:Libraries::add('li3_twitteroauth');
-
Configure TwitterOAuth in
app/config/bootstrap/twitteroauth.php
:use li3_twitteroauth\TwitterOAuth; TwitterOAuth::config(['default' => [ 'consumer_key' => /* consumer key */, 'consumer_secret' => /* consumer secret */, //'oauth_token' => /* oauth token */, //'oauth_token_secret' => /* oauth token secret */ ]];
-
Update
app/config/bootstrap.php
to include this new configuration file:/** * Include this file to enable TwitterOAuth. */ require __DIR__ . '/bootstrap/twitteroauth.php';
-
You can now use TwitterOAuth in your application:
use li3_twitteroauth\TwitterOAuth;
Here is a basic usage to get the connection object.
use li3_twitteroauth\TwitterOAuth;
$twitter = TwitterOAuth::get('default');
Everything else should be part of @abraham's library. Find its documentation here.
If you would prefer to bootstrap Abraham's TwitterOAuth library manually you can to the following:
Libraries::add('TwitterOAuth', ['prefix' => "Abraham\\TwitterOAuth\\"]);
Libraries::add('li3_twitteroauth', ['bootstrap' => false]);
This will allow you to symlink Abraham's TwitterOAuth library how ever you choose.