PHPackages                             traviswimer/twittering - 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. traviswimer/twittering

ActiveLibrary

traviswimer/twittering
======================

Twitter oAuth and API request library with an easy to use syntax.

090PHP

Since Jun 7Pushed 11y ago1 watchersCompare

[ Source](https://github.com/traviswimer/Twittering)[ Packagist](https://packagist.org/packages/traviswimer/twittering)[ RSS](/packages/traviswimer-twittering/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Twittering [![Build Status](https://camo.githubusercontent.com/34b360dc58932a5a5aca8aa42055472819cd6450ab9ffa7e8f1451cbb8e90937/68747470733a2f2f7472617669732d63692e6f72672f74726176697377696d65722f54776974746572696e672e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/traviswimer/Twittering)
============================================================================================================================================================================================================================================================================================================

[](#twittering-)

> PHP class for simple Twitter oAuth token requests, authentication, and API v1.1 requests. (Built on the [TwitterOAuth package](https://github.com/abraham/twitteroauth))

Getting Started
---------------

[](#getting-started)

Install with [Composer](https://getcomposer.org/) by adding this to your `composer.json` file:

```
"require": {
	"traviswimer/twittering": "dev-master"
}
```

Then run `compsoser install` or `php composer.phar install`, depending on your setup.

Example usage
-------------

[](#example-usage)

```
// Include Composer autoloader
require_once __DIR__.'/vendor/autoload.php';

// First create initialize a Twittering object with you API key/secret
$twittering = new \Twittering\Twittering(array(
	"api_key" => "YOUR_CONSUMER_KEY",
	"api_secret" => "YOUR_CONSUMER_SECRET",
));

// Then the requestTokens() method can be used to redirect the user to Twitter
// for authentication. The user will then be sent back to the URL of your script.
// This time, when requestTokens() is called, it will detect the $_GET parameters
// sent from Twitter and continue with the authorization process.
$tokens = $twittering->requestTokens();

// Now that you have the tokens, you can save them to a database for future use.

// To make API requests, call the authenticate() method.
$apiConnection = $twittering->authenticate( $tokens );

// You are now ready to make API requests
$timeline = $apiConnection->get( 'statuses/home_timeline', array('count' => '10') );
```

Documentation
-------------

[](#documentation)

### `new \Twittering\Twittering( $api_auth_info, );`

[](#new-twitteringtwittering-api_auth_info-)

- **$api\_auth\_info** - Array containing oAuth information.
    - "api\_key" - Your app's consumer key
    - "api\_secret" - Your app's consumer secret

### `requestTokens( $callback_url, $redirect );`

[](#requesttokens-callback_url-redirect-)

*This method behaves differently if the $\_GET variables `oauth_token` and `oauth_verifier` are set*

#### Without $\_GET variables (Initial request)

[](#without-_get-variables-initial-request)

> This will send the user to Twitter to authorize your app.

- **$callback\_url** (Default: Current URL) - *String*. The URL Twitter should redirect the user back to once they have authorized your app.
- **$redirect** (Default: true) - *Boolean*. Determines if the user should automatically be redirected to Twitter to authorize your app. If set to false, `requestTokens()` will instead return the URL where you should send the user.

#### With $\_GET variables (Twitter callback request)

[](#with-_get-variables-twitter-callback-request)

> This generate the user's long-term tokens.

No parameters are needed during this second pass. This will return an array containing the user's long-term tokens that can be stored in your database. You can also pass this array directly to the `authenticate()` method.

### `authenticate( $tokens );`

[](#authenticate-tokens-)

> This method creates an object can interact with the Twitter API on the authenticated user's behalf.

- **$tokens** - *array*. An associative array of the user's tokens. Should contain the following keys, as obtained from the `requestTokens()` method:
    - oauth\_token
    - oauth\_token\_secret

Contributing
------------

[](#contributing)

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/59dcdfae8a3acd0dfc29a1958763ba8f4fad68f72d83c5bb35b2a8be3756015f?d=identicon)[traviswimer](/maintainers/traviswimer)

---

Top Contributors

[![traviswimer](https://avatars.githubusercontent.com/u/1870011?v=4)](https://github.com/traviswimer "traviswimer (24 commits)")

### Embed Badge

![Health badge](/badges/traviswimer-twittering/health.svg)

```
[![Health](https://phpackages.com/badges/traviswimer-twittering/health.svg)](https://phpackages.com/packages/traviswimer-twittering)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
