PHP code example of endroid / twitter

1. Go to this page and download the library: Download endroid/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/ */

    

endroid / twitter example snippets


use Abraham\TwitterOAuth\TwitterOAuth;
use Endroid\Twitter\Client;

$twitterOAuth = new TwitterOAuth($consumerKey, $consumerSecret);
$client = new Client($twitterOAuth);

// Retrieve the last 50 items in the user's timeline
$tweets = $client->getTimeline(50);

// Or post a status message (with optional media)
$client->postStatus('Hello, this is my new status', ['/tmp/image1.png', '/tmp/image2.png']);