PHP code example of tychovbh / laravel-bluebillywig

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

    

tychovbh / laravel-bluebillywig example snippets


$app->register(\Tychovbh\Bluebillywig\BluebillywigServiceProvider::class);

// Request with GET parameter 'limit=10'
$response = $bluebillywig->retrieve('/sapi/mediaclip', [
    'limit' => 10
])

// Create resource
$response = $bluebillywig->create('/sapi/mediaclip', [
    'title' => 'my fantastic new title',
])

// Update resource
$response = $bluebillywig->update('/sapi/mediaclip/{id}', $id, [
    'title' => 'my fantastic new title',
])
 bash
$ php artisan vendor:publish --tag=laravel-bluebillywig
 php
use Tychovbh\Bluebillywig\Bluebillywig;

// Use class injection
Route::get('/bluebillywig', function(Bluebillywig $bluebillywig) {
    $response = $bluebillywig->retrieve('/sapi/publication')
    return response()->json($response)
});

// Or use Laravel helper app()
Route::get('/bluebillywig', function() {
    $bluebillywig = app('bluebillywig');
    $response = $bluebillywig->retrieve('/sapi/publication')
    return response()->json($response)
});
 php
use Tychovbh\Bluebillywig\Exceptions\ConfigurationException;

try {
    $bluebillywig = app('bluebillywig');
    $bluebillywig->retrieve('/sapi/mediaclip')
} catch(\ConfigurationException $exception) {
    echo $exception->getMessage();
} catch(\GuzzleException $exception) {
    echo $exception->getMessage();
} catch(\Exception $exception) {
    echo $exception->getMessage();
}