PHP code example of siewwp / laravel-service-consumer

1. Go to this page and download the library: Download siewwp/laravel-service-consumer 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-consumer example snippets




namespace App\Http\Controllers;

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

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



namespace App\Http\Controllers;

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

class InvoiceController extends Controller
{
    use HandleWebhook;

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


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