Download the PHP package redwebcreation/twitter-stream-api without Composer

On this page you can find all versions of the php package redwebcreation/twitter-stream-api. 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-stream-api

Twitter Stream API (v2)

Tests Formats codecov

Consume the Twitter Stream API v2 in real-time.

This package is the spiritual successor of fennb/phirehose. It also uses some of salsify/jsonstreamingparser and maxakawizard/json-collection-parser.

Getting started

You need an approved developer account. If you don't have one, apply here. Once you are in, create an "Application" in the Developer Portal and generate a new bearer token.

Requires PHP 8.1+

You can install the package via composer:

Then, create a connection:

Usage

Streams

Creating a stream

Configuring a stream

For advanced use

Interacting with a stream

For advanced use

Listening to a stream

Filtering the stream

This part only applies if you're interested in the filtered stream.

Building a rule

Note, If you change your rules while connected to the stream, Twitter will use the new rules immediately.

Save, read and delete rules

You can not update rules.

Let's create a rule:

You may now retrieve your newly saved rule:

Which returns an array of Felix\TwitterStream\Rule\Rule:

Note, the Felix\TwitterStream\Rule\Rule is merely a Data Object, it does not contain any method.

To delete the rule pass its ID to the delete method:

Batch Processing

To save many rules at once:

To delete these new rules,

Validating your rules

You can either use the validate() method:

Or, the save and saveMany method both have a dryRun parameter:

Rule Builder

Every operator is available, here's an example:

You may also use and[Operator], or[Operator], for example orNotFrom('ID') or andBioLocation('location').

Compiling this would produce the following:

Tips

Fields

Fields allow for more customization regarding the payload returned per tweet. Let's see that in an example below:

Which could return:

Here's the list of all the available field types and their respective object model (last updated: Aug. 2022):

You can also check out Twitter’s documentation for more details.

Expansions

Expansions let you expand ids to their complete object, for example, if you request an extra author_id field, you may expand it using the author_id expansion:

Which could return:

The list of expansions is quite extensive and not all expansions work the same, please check out Twitter's documentation. on the subject.

Testing

Twitter Stream API was created by Félix Dorn under the MIT License.


All versions of twitter-stream-api with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
guzzlehttp/guzzle Version ^7.3
psr/http-message Version ^1.0.1|^2.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 redwebcreation/twitter-stream-api contains the following files

Loading the files please wait ....