PHP code example of cvo-technologies / cakephp-twitter

1. Go to this page and download the library: Download cvo-technologies/cakephp-twitter library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

cvo-technologies / cakephp-twitter example snippets


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

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

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);
    }
}

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;
        }
    }
}