Download the PHP package noweh/twitter-api-v2-php without Composer

On this page you can find all versions of the php package noweh/twitter-api-v2-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package twitter-api-v2-php

Twitter API V2 for PHP

PHP Badge Twitter Run Tests last version Downloads twitter

Twitter API V2 is a PHP package which provides an easy and fast access to Twitter REST API for Version 2 endpoints.

Documentation

Installation

To begin, you'll need to add the component to your composer.json

After adding the component, update your packages using composer update or install them using composer install.

Github Actions

This repository uses Github Actions for each push/pull request, employing PHPStan/PHPUnit.

Consequently, with each valid push, a new Tweet is posted from the Twitter test account.

Usage

Active your developer account

Before anything else, you must follow this tutorial.

Configuration setup

Expected settings are as follows:

API Functionality

All API calls are triggered when the performRequest() method is invoked. Depending on the context, this method can either be empty or contain data that will be sent as PostData (refer to examples of each call below).

Include the HTTP headers provided by Twitter in the response

The performRequest() method accepts a second parameter, $withHeaders, which is a boolean value. Setting this parameter to true will include the headers information in the response.

Here are some examples of information included in headers:

Example:

Free mode

This API can be used in free mode, which allows for a limited usage of the API. In this mode, the Find me method is the only one that can be used. You have to set the free_mode parameter to true when creating the client.

Example:


Tweets endpoints

Timeline endpoints

Find Recent Mentioning for a User

Example:

Find Recent Tweets for a User

Example:

Reverse Chronological Timeline by user ID

Example:

Tweet/Likes endpoints

Tweets liked by a user

Example:

Users who liked a tweet

Example:

Tweet/Lookup endpoints

Search specific tweets

Example:

Find all replies from a Tweet

Tweet endpoints

Fetch a tweet by Id

Example:

Create a new Tweet

Example:

Upload image to Twitter (and use in Tweets)

Example:

Tweet/Quotes endpoints

Returns Quote Tweets for a Tweet specified by the requested Tweet ID

Example:

Retweet endpoints

Retweet a Tweet

Example:

Tweet/Replies endpoints

Hide a reply to a Tweet

Example:

Unhide a reply to a Tweet

Example:

Tweet/Bookmarks endpoints

Lookup a user's Bookmarks

Example:


Users endpoints

User/Blocks endpoints

Retrieve the users which you've blocked

Example:

User/Follows endpoints

Retrieve the users which are following you

Example:

Retrieve the users which you are following

Example:

Follow a user

Example:

Unfollow a user

Example:

User/Lookup endpoints

Find Me

Example:

Find Twitter Users

findByIdOrUsername() expects either an array, or a string.

You can specify the search mode as a second parameter (Client::MODES['USERNAME'] OR Client::MODES['ID'])

Example:

User/Mutes endpoints

Retrieve the users which you've muted

Example:

Mute user by username or ID

Example:

Unmute user by username or ID

Example:


Contributing

Fork/download the code and run

copy test/config/.env.example to test/config/.env and add your credentials for testing.

To run tests

To run code analyzer


All versions of twitter-api-v2-php with dependencies

PHP Build Version
Package Version
Requires ext-curl Version *
ext-json Version *
php Version >=7.4
guzzlehttp/guzzle Version ^7.5.0
guzzlehttp/oauth-subscriber Version ^0.6.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package noweh/twitter-api-v2-php contains the following files

Loading the files please wait ....