Skip to content

A PHP library for consuming data from the Twitter Streaming API v1.1 via OAuth

License

Notifications You must be signed in to change notification settings

impensavel/floodgate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Floodgate

Latest Stable Version Build Status

A PHP library for consuming data from the Twitter Streaming API v1.1 via OAuth.

This library aims for PSR-1, PSR-2 and PSR-4 standards compliance.

Requirements

Installation

composer require "impensavel/floodgate"

Basic usage example

<?php

require 'vendor/autoload.php';

use Impensavel\Floodgate\Floodgate;
use Impensavel\Floodgate\FloodgateException;

try {
    $config = [
        'oauth' => [
            'consumer_key'    => 'OADYKJgKogkkYtzdIKLZEq77Z',
            'consumer_secret' => 'Z0mImnDYzH3Tbe4eyQLQEA0lyzXsWFmmZsQTAYHtBrSBX04bKK',
            'token'           => '456786512-D4MnYQ3U74wd40zXHRHa495wl00ogOyhJu9iqEhz',
            'token_secret'    => 'EUyz6MawvBlabLAb2gY6fgyTagtMMYny7GmzKfulGo3Di',
        ],
    ];

    $floodgate = Floodgate::create($config);

    // Data handler
    $handler = function ($message)
    {
        // dump each message from the stream
        var_dump($message);
    };

    // API endpoint parameter generator
    $generator = function ()
    {
        return [
            'track' => 'php',
        ];
    };

    // consume the Twitter Streaming API filter endpoint
    $floodgate->filter($handler, $generator);

} catch (FloodgateException $e) {
    // handle exceptions
}

Class documentation

Twitter Documentation

License

The MIT License (MIT). Please see License File for more information.

About

A PHP library for consuming data from the Twitter Streaming API v1.1 via OAuth

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages