承接 moneo/laravel-request-forwarder 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

moneo/laravel-request-forwarder

最新稳定版本:1.0.2

Composer 安装命令:

composer require moneo/laravel-request-forwarder

包简介

Laravel Request Forwarder allows you to forward incoming requests to another addresses.

README 文档

README

Laravel Request Forwarder

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Sometimes we need to redirect requests to our application to other addresses. The best example of this is webhooks. Some service providers only send webhooks to a single address. With this package, you can post the requests coming to your application to another address as it is.

In addition to sending to a single URL, you can also send to different destinations by typing a custom provider. In our package you can see an example that sends notifications to Discord!

Installation

You can install the package via composer:

composer require moneo/laravel-request-forwarder

You can publish the config file with:

php artisan vendor:publish --tag="request-forwarder-config"

This is the contents of the published config file:

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,
];

Usage

Add middleware to your routes which will be forwarded

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');

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 368
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 61
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 61
  • Watchers: 3
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-02-22