PHPackages                             tzlion/deadend-api-php - 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. tzlion/deadend-api-php

ActiveLibrary[API Development](/categories/api)

tzlion/deadend-api-php
======================

Simple PHP Wrapper for Twitter API v1.1/v2 calls

v0.2.0(1y ago)132.1k↓19.2%2MITPHP

Since Jun 2Pushed 1y ago1 watchersCompare

[ Source](https://github.com/tzlion/deadend-api-php)[ Packagist](https://packagist.org/packages/tzlion/deadend-api-php)[ Docs](https://github.com/tzlion/deadend-api-php)[ RSS](/packages/tzlion-deadend-api-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (2)

deadend-api-php
===============

[](#deadend-api-php)

Simple PHP Wrapper for X/Twitter API v1.1 and v2 calls

Forked from [J7mbo/twitter-api-php](https://github.com/J7mbo/twitter-api-php) to allow the continued operation of some personal projects.

**This library is not supported and v2 functionality has only been tested for certain limited use cases.****I do not recommend you develop against the X/Twitter API in general due to the instability of the platform and its management.**

Original documentation follows
------------------------------

[](#original-documentation-follows)

**The documentation from this point has been minimally updated and may be outdated in parts!**

**[Changelog](https://github.com/J7mbo/twitter-api-php/wiki/Changelog)** || **[Examples](https://github.com/J7mbo/twitter-api-php/wiki/Twitter-API-PHP-Wiki)** || **[Wiki](https://github.com/J7mbo/twitter-api-php/wiki)**

[Instructions in StackOverflow post here](http://stackoverflow.com/questions/12916539/simplest-php-example-retrieving-user-timeline-with-twitter-api-version-1-1/15314662#15314662) with examples. This post shows you how to get your tokens and more. If you found it useful, please upvote / leave a comment! :)

The aim of this class is simple. You need to:

- Include the class in your PHP code
- [Create a twitter app on the twitter developer site](https://dev.twitter.com/apps/)
- Enable read/write access for your twitter app
- Grab your access tokens from the twitter developer site
- [Choose a twitter API URL to make the request to](https://dev.twitter.com/docs/api/1.1/)
- Choose either GET / POST (depending on the request)
- Choose the fields you want to send with the request (example: `array('screen_name' => 'usernameToBlock')`)

You really can't get much simpler than that. The above bullet points are an example of how to use the class for a POST request to block a user, and at the bottom is an example of a GET request.

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

[](#installation)

**Normally:** If you *don't* use composer, don't worry - just include TwitterAPIExchange.php in your application.

```
require_once('TwitterAPIExchange.php');
```

**Via Composer:**

```
composer require tzlion/deadend-api-php
```

How To Use
----------

[](#how-to-use)

#### Set access tokens

[](#set-access-tokens)

```
$settings = array(
    'oauth_access_token' => "YOUR_OAUTH_ACCESS_TOKEN",
    'oauth_access_token_secret' => "YOUR_OAUTH_ACCESS_TOKEN_SECRET",
    'consumer_key' => "YOUR_CONSUMER_KEY",
    'consumer_secret' => "YOUR_CONSUMER_SECRET"
);
```

#### Choose URL and Request Method

[](#choose-url-and-request-method)

```
$url = 'https://api.twitter.com/1.1/blocks/create.json';
$requestMethod = 'POST';
```

#### Choose POST fields (or PUT fields if you're using PUT)

[](#choose-post-fields-or-put-fields-if-youre-using-put)

```
$postfields = array(
    'screen_name' => 'usernameToBlock',
    'skip_status' => '1'
);
```

#### Perform the request!

[](#perform-the-request)

For v1.1 endpoints

```
$twitter = new TwitterAPIExchange($settings);
echo $twitter->buildOauth($url, $requestMethod)
    ->setPostfields($postfields)
    ->performRequest();
```

For V2 endpoints (JSON POST request)

```
$twitter = new TwitterAPIExchange($settings);
echo $twitter->buildOauth($url, $requestMethod)
    ->setPostfields($postfields, true)
    ->performRequest();
```

GET Request Example
-------------------

[](#get-request-example)

Set the GET field BEFORE calling buildOauth(); and everything else is the same:

```
$url = 'https://api.twitter.com/1.1/followers/ids.json';
$getfield = '?screen_name=J7mbo';
$requestMethod = 'GET';

$twitter = new TwitterAPIExchange($settings);
echo $twitter->setGetfield($getfield)
    ->buildOauth($url, $requestMethod)
    ->performRequest();
```

That is it! Really simple, works great with the 1.1 API. Thanks to @lackovic10 and @rivers on SO!

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

 Bus Factor1

Top contributor holds 68.4% 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.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

715d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/39ae7a17a6d541b80e78e9c771c9f6e33ffd64f6545eeed4de53795962d09fc7?d=identicon)[lions](/maintainers/lions)

---

Top Contributors

[![J7mbo](https://avatars.githubusercontent.com/u/2657310?v=4)](https://github.com/J7mbo "J7mbo (67 commits)")[![glenscott](https://avatars.githubusercontent.com/u/124257?v=4)](https://github.com/glenscott "glenscott (11 commits)")[![tzlion](https://avatars.githubusercontent.com/u/12863401?v=4)](https://github.com/tzlion "tzlion (6 commits)")[![finwe](https://avatars.githubusercontent.com/u/195675?v=4)](https://github.com/finwe "finwe (3 commits)")[![ronaldpk](https://avatars.githubusercontent.com/u/1880399?v=4)](https://github.com/ronaldpk "ronaldpk (3 commits)")[![jezmck](https://avatars.githubusercontent.com/u/89996?v=4)](https://github.com/jezmck "jezmck (1 commits)")[![naoyukik](https://avatars.githubusercontent.com/u/10615135?v=4)](https://github.com/naoyukik "naoyukik (1 commits)")[![phansys](https://avatars.githubusercontent.com/u/1231441?v=4)](https://github.com/phansys "phansys (1 commits)")[![hugovk](https://avatars.githubusercontent.com/u/1324225?v=4)](https://github.com/hugovk "hugovk (1 commits)")[![dave1010](https://avatars.githubusercontent.com/u/50682?v=4)](https://github.com/dave1010 "dave1010 (1 commits)")[![emmetog](https://avatars.githubusercontent.com/u/1182891?v=4)](https://github.com/emmetog "emmetog (1 commits)")[![Farkie](https://avatars.githubusercontent.com/u/294921?v=4)](https://github.com/Farkie "Farkie (1 commits)")[![ArnaudLigny](https://avatars.githubusercontent.com/u/80580?v=4)](https://github.com/ArnaudLigny "ArnaudLigny (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tzlion-deadend-api-php/health.svg)

```
[![Health](https://phpackages.com/badges/tzlion-deadend-api-php/health.svg)](https://phpackages.com/packages/tzlion-deadend-api-php)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

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