markwilde / li3_twitteroauth

Integrates Abraham's TwitterOAuth Library into Lithium (Li3).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

li3_twitteroauth

Description

This plugin integrates the Abraham's TwitterOAuth library to Lithium (Li3).

Dependencies

This library requires https://github.com/abraham/twitteroauth

Installation

  1. Install Abraham's Twitter OAuth library into libraries/_source/twitteroauth

  2. Symlink _source/twitteroauth/src to libraries/TwitterOAuth

  3. To enable the library add the following to app/config/bootstrap/libraries.php:

    Libraries::add('li3_twitteroauth');

Configuration

  1. 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 */
    ]];
  2. Update app/config/bootstrap.php to include this new configuration file:

    /**
     * Include this file to enable TwitterOAuth.
     */
    require __DIR__ . '/bootstrap/twitteroauth.php';
  3. You can now use TwitterOAuth in your application:

    use li3_twitteroauth\TwitterOAuth;

Usage

Here is a basic usage to get the connection object.

use li3_twitteroauth\TwitterOAuth;

$twitter = TwitterOAuth::get('default');

More documentation

Everything else should be part of @abraham's library. Find its documentation here.

Notes

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.

About

Integrates Abraham's TwitterOAuth Library into Lithium (Li3).

License:GNU Lesser General Public License v3.0


Languages

Language:PHP 100.0%