PHP code example of nawaf / laravel-x

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

    

nawaf / laravel-x example snippets



// Example: posting a tweet
$response = X::post('statuses/update', ['status' => 'Hello X!']);

// Example: fetching your timeline
$tweets = X::get('statuses/home_timeline');

use Nawaf\LaravelX\X;

public function __construct(X $x)
{
    $this->x = $x;
}

public function index()
{
    $tweets = $this->x->get('statuses/home_timeline');
    return $tweets;
}
bash
php artisan vendor:publish --provider="Nawaf\LaravelX\XServiceProvider"