PHP code example of siewwp / laravel-service-host

1. Go to this page and download the library: Download siewwp/laravel-service-host library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

siewwp / laravel-service-host example snippets


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

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



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 [
            // ...
        ];
    }
    
    // ...
}
 bash
php artisan vendor:publish --provider="Siewwp\LaravelServiceHost\ServiceHostServiceProvider" --tag="config"
 bash
php artisan vendor:publish --provider="Siewwp\LaravelServiceHost\ServiceHostServiceProvider" --tag="migrations"

php artisan migrate

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