jomweb/billplz-laravel

Laravel adapter for Billplz

v1.2.0 2019-03-17 11:29 UTC

README

Build Status Latest Stable Version Total Downloads Latest Unstable Version License Coverage Status

Installation

To install through composer, simply put the following in your composer.json file:

{
    "require": {
        "jomweb/billplz-laravel": "^1.1"
    }
}

And then run composer install from the terminal.

Quick Installation

Above installation can also be simplify by using the following command:

composer require "jomweb/billplz-laravel=^1.1"

Configuration

Next add the service provider in config/app.php.

'providers' => [

    // ...

    Billplz\Laravel\BillplzServiceProvider::class,

],

Aliases

You might want to add Billplz\Laravel\Billplz to class aliases in config/app.php:

'aliases' => [

    // ...

    'Billplz' => Billplz\Laravel\Billplz::class,

],

Billplz Configuration

Next add the configuration in config/services.php.

<?php 

return [

    // ...

    'billplz' => [
        'key' => env('BILLPLZ_API_KEY'),
        'version' => env('BILLPLZ_VERSION', 'v4'),
        'x-signature' => env('BILLPLZ_X_SIGNATURE'),
        'sandbox' => env('BILLPLZ_SANDBOX', false),
    ],
];

Usages

Creating Client

With jomweb/billplz-laravel you have the option to initiate the client using the following methods.

Facade

use Billplz\Laravel\Billplz;

$bill = Billplz::bill()->create( /* ... */ );

IoC

$bill = resolve('billplz')->bill()->create( /* ... */ );

Dependency Injection

use Billplz\Client;

// ...

public function createBill(Client $client)
{
    $bill = $client->bill()->create( /* ... */ );

}