PHPackages                             octoauth/oauth2-twitter-adapter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. octoauth/oauth2-twitter-adapter

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

octoauth/oauth2-twitter-adapter
===============================

An adapter to allow you to interact with the 'abraham/twitteroauth' OAuth1 library alongside the 'phpleague/oauth2-\*' libraries

0.5(9y ago)2291MITPHP

Since Jan 19Pushed 7y ago2 watchersCompare

[ Source](https://github.com/8w/oauth2-twitter-adapter)[ Packagist](https://packagist.org/packages/octoauth/oauth2-twitter-adapter)[ Docs](https://github.com/8w/oauth2-twitter-adapter)[ RSS](/packages/octoauth-oauth2-twitter-adapter/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

Twitter OAuth1 Wrapper for Consistency with phpleague/oauth2-client
===================================================================

[](#twitter-oauth1-wrapper-for-consistency-with-phpleagueoauth2-client)

Twitter is conspicously absent from the list of OAuth2 providers [support by the phpleague's oauth2-client](https://github.com/thephpleague/oauth2-client/blob/master/docs/providers/thirdparty.md). That's because Twitter doesn't support OAuth2 for User Authentication, though they do offer OAuth 1.0 support.

This package provides a wrapper for the excellent `abraham/twitteroauth` library (which uses OAuth 1.0 to interact with Twitter), so that it can be used more easily alongside the various PhpLeague's OAuth2 clients.

Installation
------------

[](#installation)

To install, use [composer](https://getcomposer.org/):

```
./composer.phar require octoauth/oauth2-twitter-adapter
```

Usage
-----

[](#usage)

### Begin Auth

[](#begin-auth)

Instantiate a `TwitterOAuth1` client, passing in a mechanism for retaining the OAuth1 temporary token between page requests. A session-based store is provided, but if you run a session-less app you can very easily create your own implementation of `OAuth1TemporaryTokenStore` to use a database or alternative:

```
