2017 © Pedro Peláez
 

library laravel-service-consumer

laravel server-to-server service consumer with HMAC authentication

image

siewwp/laravel-service-consumer

laravel server-to-server service consumer with HMAC authentication

  • Monday, July 30, 2018
  • by siewwp
  • Repository
  • 1 Watchers
  • 0 Stars
  • 209 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

Laravel hmac http

Server-to-server service consuming with hmac authentication., (*1)

Installation

composer require siewwp/laravel-service-consumer:dev-master

Usage

Binding your key

Your should bind your app id and secret at your ServiceProvider., (*2)

Refer to Hmac http client for more information., (*3)

Refer to Laravel Container for more information., (*4)

Handling webhook notification

If the service host is notifying event using webhook, you may define your webhook handler in your controller and extend to the webhook controller like so:, (*5)

<?php

namespace App\Http\Controllers;

use Siewwp\LaravelServiceConsumer\Http\Controllers\Webhook;
use App\Http\Controllers\Controller;

class InvoiceController extends Controller
{
    public function handleInvoicePaid($payload) {
        // ...
    }
}

Or you can use the Siewwp\LaravelServiceConsumer\HandleWebhook trait in your controller, (*6)

<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use Siewwp\LaravelServiceConsumer\HandleWebhook;

class InvoiceController extends Controller
{
    use HandleWebhook;

    public function handleInvoicePaid($payload) {
        // ...
    }
}

The name of the webhook method should be 'handle' + 'CamelCase' of the type of event notification. In the example above, is to handle InvoicePaid type event., (*7)

Refer to laravel-service-host for more information., (*8)

After that, you may register the webhook controller it on RouteServiceProvider.php file., (*9)

<?php
    // ...
    public function boot()
    {
        // ...
        Route::post(
            'tenant/webhook',
            '\App\Http\Controllers\InvoiceController@handleWebhook'
        );
    }
    ...

You can also register it on your web routes but you may need to exclude CSRF middleware, (*10)

TO DO

TESTING, (*11)

The Versions

30/07 2018

dev-master

9999999-dev

laravel server-to-server service consumer with HMAC authentication

  Sources   Download

MIT

The Requires

 

The Development Requires

by WP Siew

30/07 2018

v1.1.1

1.1.1.0

laravel server-to-server service consumer with HMAC authentication

  Sources   Download

MIT

The Requires

 

The Development Requires

by WP Siew

30/07 2018

v1.1.0

1.1.0.0

laravel server-to-server service consumer with HMAC authentication

  Sources   Download

MIT

The Requires

 

The Development Requires

by WP Siew

16/06 2018

v1.0.1

1.0.1.0

laravel server-to-server service consumer with HMAC authentication

  Sources   Download

MIT

The Requires

 

The Development Requires

by WP Siew

16/06 2018

v1.0.0

1.0.0.0

laravel server-to-server service consumer with HMAC authentication

  Sources   Download

MIT

The Requires

 

The Development Requires

by WP Siew

16/06 2018

v0.1

0.1.0.0

laravel server-to-server service consumer with HMAC authentication

  Sources   Download

MIT

The Requires

 

The Development Requires

by WP Siew