2017 © Pedro Peláez
 

library laravel-service-host

laravel server-to-server service host with HMAC authentication

image

siewwp/laravel-service-host

laravel server-to-server service host with HMAC authentication

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

The README.md

Laravel service host

Installation

composer require siewwp/laravel-service-host:^1.0.0

Publish service host config ``` bash php artisan vendor:publish --provider="Siewwp\LaravelServiceHost\ServiceHostServiceProvider" --tag="config", (*1)


Publish service host migration ``` bash php artisan vendor:publish --provider="Siewwp\LaravelServiceHost\ServiceHostServiceProvider" --tag="migrations"

Run migration, (*2)

php artisan migrate

run the command below on console to create host, (*3)

php artisan service-host:client {name} {webhook_url}

Guide

Authenticating client request

Add clients user provider in your auth.php configuration file., (*4)

'providers' => [
    'clients' => [
        'driver' => 'eloquent',
        'model' => Siewwp\LaravelServiceHost\Client::class,
    ],
],

Finally, you may use this provider in your guards configuration:, (*5)

'guards' => [
    'client' => [
        'driver' => 'service-host',
        'provider' => 'clients',
    ],
],

Sending a webhook notification

To send notification, create a notification and specify WebhookChannel::class like below:, (*6)

<?php

namespace App\Notifications;

use Illuminate\Notifications\Notification;
use Siewwp\LaravelServiceHost\Channels\WebhookChannel;

class InvoicePaid extends Notification
{
    public function via($notifiable)
    {
        return [WebhookChannel::class];
    }

    public function toWebhook($notifiable)
    {
        return [
            // ...
        ];
    }

    // ...
}

TODO

TEST, (*7)

The Versions