2017 © Pedro Peláez
 

cakephp-plugin twitter

CakePHP webservice implementation for Twitter

image

cvo-technologies/twitter

CakePHP webservice implementation for Twitter

  • Sunday, March 5, 2017
  • by Marlinc
  • Repository
  • 5 Watchers
  • 17 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

Twitter plugin

Software License Build Status Coverage Status Total Downloads Latest Stable Version, (*1)

Installation

Using Composer

composer require cvo-technologies/cakephp-twitter

Ensure require is present in composer.json:, (*2)

{
    "require": {
        "cvo-technologies/cakephp-twitter": "~1.1"
    }
}

Load the plugin

Plugin::load('Muffin/Webservice', ['bootstrap' => true]);
Plugin::load('CvoTechnologies/Twitter');

Configure the Twitter webservice

Add the following to the Datasources section of your application config., (*3)

        'twitter' => [
            'className' => 'Muffin\Webservice\Connection',
            'service' => 'CvoTechnologies/Twitter.Twitter',
            'consumerKey' => '',
            'consumerSecret' => '',
            'oauthToken' => '',
            'oauthSecret' => ''
        ]

Usage

Controller

namespace App\Controller;

use Cake\Event\Event;

class StatusesController extends AppController
{
    public function beforeFilter(Event $event)
    {
        $this->loadModel('CvoTechnologies/Twitter.Statuses', 'Endpoint');
    }

    public function index()
    {
        $statuses = $this->Statuses->find()->where([
            'screen_name' => 'CakePHP',
        ]);

        $this->set('statuses', $statuses);
    }
}

Streaming example

This is an example of how to implement the Twitter streaming API., (*4)

namespace App\Shell;

use Cake\Console\Shell;

class StreamShell extends Shell
{
    public function initialize()
    {
        $this->modelFactory('Endpoint', ['Muffin\Webservice\Model\EndpointRegistry', 'get']);
        $this->loadModel('CvoTechnologies/Twitter.Statuses', 'Endpoint');
    }

    public function main()
    {
        $statuses = $this->Statuses
            ->find('filterStream', [
                'word' => 'twitter',
            ]);

        foreach ($statuses as $status) {
            echo $status->text . PHP_EOL;
        }
    }
}

The Versions

05/03 2017

dev-master

9999999-dev

CakePHP webservice implementation for Twitter

  Sources   Download

MIT

The Requires

 

The Development Requires

15/08 2016
08/08 2016
19/03 2016

dev-crud-view-support

dev-crud-view-support

Twitter plugin

  Sources   Download

MIT

The Requires

 

The Development Requires

23/02 2016

1.0.x-dev

1.0.9999999.9999999-dev

Twitter plugin

  Sources   Download

MIT

The Requires

 

The Development Requires

23/02 2016

1.0.0

1.0.0.0

Twitter plugin

  Sources   Download

MIT

The Requires

 

The Development Requires

14/02 2016

0.1

0.1.0.0

Twitter plugin

  Sources   Download

MIT

The Requires

 

The Development Requires