承接 jurihub/laravel-webhooks 相关项目开发

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

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

jurihub/laravel-webhooks

Composer 安装命令:

composer require jurihub/laravel-webhooks

包简介

Laravel package to handle Webhooks

README 文档

README

Laravel package to handle Webhooks

Installation guide

Include the page via Composer:

composer require jurihub/laravel-webhooks

Add the Webhooks service provider to your config/app.php file in the providers array:

Jurihub\LaravelWebhooks\WebhooksServiceProvider::class

To use a Facade instead of injecting the class itself, add this to the aliases array in the same file:

'Webhooks' => Jurihub\LaravelWebhooks\WebhooksFacade::class

Publish the configuration file:

php artisan vendor:publish --provider="Jurihub\LaravelWebhooks\WebhooksServiceProvider" --tag="config"

You certainly will want to add some endpoints, list them in the targets array in config/webhooks.php

Launch the migrations (provided automatically by the ServiceProvider), that will create 2 new tables: webhooks and webhook_tries

php artisan migrate

The first attempt is sent automatically, but if you want to automatize retries, add the following schedule in your app/Console/Kernel.php file:

$schedule->call(function () {
    \Jurihub\LaravelWebhooks\Http\Controllers\Webhooks\SenderController::retry();
})->everyMinute();

To handle incoming webhooks, create a new controller, eg. App\Http\Controllers\Webhooks\ReceiverController.php

namespace App\Http\Controllers\Webhooks;

use Symfony\Component\HttpFoundation\Response;
use Jurihub\LaravelWebhooks\Http\Controllers\Webhooks\ReceiverController as BaseController;

class ReceiverController extends BaseController
{
    public function handleUserUpdated($data)
    {
        // handling $data here for type 'user.updated'
    }
}

And add the route to your routes/api.php file to receive the incoming webhooks. You may want to customize the endpoint, according to the targets listed in the config/app.php file.

Route::post('webhook', 'Webhooks\ReceiverController@handleWebhook');

Activate the webhooks' sending queue:

php artisan queue:work database --queue=webhook --tries=3

统计信息

  • 总下载量: 1.86k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-05-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固