PHP code example of moneo / laravel-request-forwarder

1. Go to this page and download the library: Download moneo/laravel-request-forwarder 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/ */

    

moneo / laravel-request-forwarder example snippets


return [
    // decides which webhook to use if no webhook group name is specified while use middleware
    'default_webhook_group_name' => 'default',

    'webhooks' => [
        'default' => [
            'targets' => [
                [
                    'url' => 'https://some-domain.com/webhook',
                    'method' => 'POST',
                ],
                [
                    'url' => 'https://discord.com/api/webhooks/1209955556656291860/LAaczT-Pg785d5OzBmi6ivx2Vl7wAoruOwcVnZpb2eE2x8tf7fMi6R7_sr0IV0WoK83S',
                    'method' => 'POST',
                    'provider' => \Moneo\RequestForwarder\Providers\Discord::class,
                ],
            ],
        ],
    ],

    'queue_name' => '',

    'queue_class' => Moneo\RequestForwarder\ProcessRequestForwarder::class,
];

Route::middleware('request-forwarder') // default group
    ->get('/endpoint', fn () => 'Some Response');

Route::middleware('request-forwarder:another-group-in-config') // customize targets with group name parameter
    ->get('/endpoint', fn () => 'Some Response');
bash
php artisan vendor:publish --tag="request-forwarder-config"