swarming/buzzi-laravel

This package is abandoned and no longer maintained. No replacement package was suggested.

A service which wraps the functionality of the Buzzi PHPSDK for easy use within the Laravel framework.

0.2.0 2017-10-31 21:22 UTC

This package is not auto-updated.

Last update: 2021-02-20 08:33:01 UTC


README

Buzzi for the PHP framework Laravel

Installation

The recommended way to install swarming/buzzi-laravel is through composer.

composer require swarming/buzzi-laravel

Lumen

In Lumen find the Register Service Providers in your bootstrap/app.php and register the Buzzi Service Provider.

    $app->register(Buzzi\Laravel\ServiceProvider::class);

Laravel

In Laravel find the providers key in your config/app.php and register the Buzzi Service Provider.

    'providers' => array(
        // ...
        Buzzi\Laravel\ServiceProvider::class,
    )

Find the aliases key in your config/app.php and add the Buzzi facade alias.

    'aliases' => array(
        // ...
        'Buzzi' => Buzzi\Laravel\Facade::class,
    )

Configuration

By default, the package uses the following environment variables to auto-configure the plugin without modification:

BUZZI_API_ID
BUZZI_API_SECRET

To customize the configuration file, publish the package configuration using Artisan.

php artisan vendor:publish

Update your settings in the generated app/config/buzzi.php configuration file.

return [

    'api' => [
        'id'     => env('BUZZI_API_ID',     '<your-buzzi-api-id-here>'),
        'secret' => env('BUZZI_API_SECRET', '<your-buzzi-api-secret-here>')
    ]

];

Usage

In order to use the Buzzi SDK for PHP within your app, you need to retrieve it from the Laravel Service Container. The following example uses the Buzzi client to send an event.

$buzzi = App::make('buzzi');

$buzzi->send('buzzi.ecommerce.test', ["message" => "Hello, World", "timestamp" => date(DATE_ATOM)]);

If the Buzzi facade is registered within the aliases section of the application configuration, you can also use the following technique.

Buzzi::send('buzzi.ecommerce.test', ["message" => "Hello, World", "timestamp" => date(DATE_ATOM)]);