kelude/laravel-forwarder is a Laravel package for laravel forwarder..
It currently has 0 GitHub stars and 14 downloads on Packagist.
Install it with composer require kelude/laravel-forwarder.
Discover more Laravel packages by kelude
or browse all Laravel packages to compare alternatives.
Last updated
A Laravel package to easily handle incoming Forwarder webhooks.
You can install the package via composer:
composer require kelude/laravel-forwarder:dev-main
After installing, run the install command to scaffold the necessary files:
php artisan forwarder:install
This command will:
config/forwarder.php.app/Actions/Forwarder/HandleWebhook.php.ForwarderServiceProvider in your application.The package uses an Action class to handle incoming webhooks. After installation, you can find the handler at app/Actions/Forwarder/HandleWebhook.php.
You should modify the handle method in this class to implement your custom logic (e.g., saving the message to the database, forwarding it to Telegram/Slack, etc.).
<?php
namespace App\Actions\Forwarder;
use Illuminate\Http\Request;
// use Illuminate\Support\Facades\Log;
use Kelude\Forwarder\Contracts\HandlesWebhooks;
use Symfony\Component\HttpFoundation\Response;
class HandleWebhook implements HandlesWebhooks
{
/**
* Handle a webhook call.
*
* @param Request $request
* @return Response
*/
public function handle(Request $request): Response
{
// Log::info('Webhook Received', $request->all());
// Your logic here...
return new Response('Webhook Handled', Response::HTTP_OK);
}
}
You can configure the package in config/forwarder.php.
By default, the webhook route is available at /forwarder/webhook. You can change the prefix in the config or via .env:
FORWARDER_PREFIX=custom-prefix
You can add custom middleware to the webhook route in config/forwarder.php:
'middleware' => ['api'],
To ensure that the webhook requests are coming from a trusted source, you should configure a webhook secret.
Set the secret in your .env file:
FORWARDER_WEBHOOK_SECRET=your-secret-key
The package will automatically verify the signature included in the request body (sign parameter) using this secret.
If the secret is not set, signature verification is skipped (not recommended for production).
You can run the tests with:
vendor/bin/pest
The MIT License (MIT).