tychovbh/laravel-bluebillywig is a Laravel package for a bluebillywig bridge for laravel 5.
It currently has 0 GitHub stars and 77 downloads on Packagist (latest version v1.3).
Install it with composer require tychovbh/laravel-bluebillywig.
Discover more Laravel packages by tychovbh
or browse all Laravel packages to compare alternatives.
Last updated
Laravel Blue Billywig is created by, and is maintained by Tycho, and is a Laravel/Lumen package to connect with Blue Billywig API. Feel free to check out the change log, releases, license, and contribution guidelines
Laravel Blue Billywig requires PHP 7.1 or 7.2. This particular version supports Laravel 5.5 - 5.7 only and Lumen.
To get the latest version, simply require the project using Composer.
$ composer require tychovbh/laravel-bluebillywig
Once installed, if you are not using automatic package discovery, then you need to register the Tychovbh\Bluebillywig\BluebillywigServiceProvider service provider in your config/app.php.
In Lumen add de Service Provider in bootstrap/app.php:
$app->register(\Tychovbh\Bluebillywig\BluebillywigServiceProvider::class);
Laravel Blue Billywig requires publication configuration.
To get started, you'll need to publish all vendor assets:
$ php artisan vendor:publish --tag=laravel-bluebillywig
This will create a config/bluebillywig.php file in your app that you can modify to set your configuration. Also, make sure you check for changes to the original config file in this package between releases.
In lumen you have to create the configuration file manually since vendor:publish is not available. Create the file config/bluebillywig.php and copy paste the example file.
There are two config options:
This option ('default') is where you may specify which of the publications below you wish to use as your default publication for all work. Of course, you may use many connections at once using the $bluebillywig->publication('my_publication') method. The default value for this setting is 'public'.
This option ('publications') is where each of the publications are setup for your application. Example configuration has been included, but you may add as many publications as you would like.
This is the class of most interest. This will send authenticated requests to Blue Billywig API. Go to their documentation for all available endpoints.
Instantiate Bluebillywig class:
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)
});
Available Bluebillywig methods:
// The examples below use the default publication.
$response = $bluebillywig->retrieve('/sapi/mediaclip')
$response = $bluebillywig->retrieve('/sapi/mediaclip/' . $id)
$response = $bluebillywig->create('/sapi/mediaclip', $formData)
$response = $bluebillywig->update('/sapi/mediaclip/{id}', $id, $formData)
$response = $bluebillywig->delete('/sapi/mediaclip', $id)
// in this example we request data from my_publication.
// my_publication key should be added to publications in the confiugration file.
$response = $bluebillywig->publication('my_publication')->retrieve('/sapi/playlist')
// You can use other API endpoints like /json/mediaclip:
$response = $bluebillywig>retrieve('/json/mediaclip')
You can send parameters with some of the requests:
// 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',
])
You will need to handle Exceptions from Bluebillywig yourself:
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();
}
Please see CHANGELOG for more information on what has changed recently.
For testing tests/feature/* copy tests/.env.example to tests/.env and fill in your Blue Billywig testing account credentials.
$ composer test
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.