PHPackages                             tang/twitter-rest-api - 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. [API Development](/categories/api)
4. /
5. tang/twitter-rest-api

ActiveLibrary[API Development](/categories/api)

tang/twitter-rest-api
=====================

Classes that interface with Twitter REST API v1.1 using Application-only authentication

328PHP

Since Mar 9Pushed 12y ago2 watchersCompare

[ Source](https://github.com/skaterdav85/twitter-library)[ Packagist](https://packagist.org/packages/tang/twitter-rest-api)[ RSS](/packages/tang-twitter-rest-api/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Twitter API Library for Applications
====================================

[](#twitter-api-library-for-applications)

### Install

[](#install)

You can install this package through Composer:

### Getting Started

[](#getting-started)

Visit  to define an application on Twitter and save your API key information.

Currently this library only supports [application-only authentication](https://dev.twitter.com/docs/auth/application-only-auth). This means that any request to the API for endpoints that require user context, such as posting tweets, **will not work**.

#### Searching tweets

[](#searching-tweets)

```
$twitterSearch = new Tang\TwitterRestApi\TwitterApi([
	'api_key' => API_KEY,
	'api_secret' => API_SECRET
]);

$json = $twitterSearch->authenticate()->get('search/tweets', [
	'q' => 'laravel'
]);
```

You can pass in a 3rd argument to the TwitterApi::get() and this will return the JSON decoded.

#### Getting a user's timeline

[](#getting-a-users-timeline)

```
$twitterApi = new Tang\TwitterRestApi\TwitterApi([
	'api_key' => API_KEY,
	'api_secret' => API_SECRET
]);

$json = $twitterApi->authenticate()->get('statuses/user_timeline', [
	'screen_name' => 'uscitp',
	'count' => 10,
	'exclude_replies' => true
]);
```

You can pass in any application level base route to the get method along with query string params passed as an array.

### Working Examples

[](#working-examples)

See the examples folder for working examples

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

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/d982e0cc35bcb3bb9197e4a25b72e660637a2c01a997d9c8190ea9e2d2e6fd62?d=identicon)[skaterdav85](/maintainers/skaterdav85)

### Embed Badge

![Health badge](/badges/tang-twitter-rest-api/health.svg)

```
[![Health](https://phpackages.com/badges/tang-twitter-rest-api/health.svg)](https://phpackages.com/packages/tang-twitter-rest-api)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35816.3M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172437.8k11](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

94452.6k6](/packages/botman-driver-telegram)

PHPackages © 2026

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