trucky/webhook
Composer 安装命令:
composer require trucky/webhook
包简介
Trucky Webhook for Custom Drivers' Hub
README 文档
README
Installation
composer require trucky/webhook
Configuration
If you want to configure the Webhook listen URL, eject the config file with
php artisan vendor:publish --provider=Trucky\Webhook\TruckyWebhookServiceProvider --tag=config
HTTP
The Webhook listens by default on /trucky/webhook for POST requests
Webhook format
Every Webhook request has a type property denoting what is you receveiving in the data property
{
"type": "job_created"
"data": {
....
}
}
Raw Event Types
- application_accepted
- application_created
- application_rejected
- application_retired
- garage_created
- garage_deleted
- garage_updgraded
- job_created
- job_cancelled
- job_completed
- job_deleted
- job_event_created
- member_kicked
- member_left
- user_joined_company
- member_role_assigned
- role_created
- role_updated
- role_deleted
- vehicle_created
- vehicle_updated
- vehicle_deleted
- vehicle_need_maintenance
- vehicle_maintenance_complete
Events
When a Webhook call is received, the Controller relaunch two Events: a Trucky\Webhook\TruckyGenericEvent and a specific event typized for each event type
You can choose if listen to the Generic Event or listen to each specific event you want to handle
Under the namespace Trucky\Webhook\Events you will find the specific events relaunched from the Webhook call.
Each Event class contains a data property containing the Event Body.
Available Events under \Trucky\Webhooks namespace
- TruckyGenericEvent
- ApplicationAccepted
- ApplicationCreated
- ApplicationRejected
- ApplicationRetired
- GarageCreated
- GarageDeleted
- GarageUpgraded
- JobCreated
- JobCancelled
- JobCompleted
- JobDeleted
- JobEventCreated
- MemberKicked
- MemberLeft
- UserJoinedCompany
- MemberRoleAssigned
- RoleCreated
- RoleUpdated
- RoleDeleted
- VehicleCreated
- VehicleUpdated
- VehicleDeleted
- VehicleAssigned
- VehicleNeedMaintenance
- VehicleMaintenanceComplete
Create your Event Listeners and register them
Listener:
<?php namespace App\Listeners; use Trucky\Webhook\Events\JobCreated; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Queue\InteractsWithQueue; class JobCreatedEventListener { /** * Create the event listener. */ public function __construct() { // } /** * Handle the event. */ public function handle(JobCreated $event): void { // // dd($event); } }
and register it in the EventServiceProvider of your Laravel application
protected $listen = [ ... // for the generic event TruckyGenericEvent::class => [ TruckyGenericEventListener::class ], // for specific events JobCreated::class => [ JobCreatedEventListener::class ] ]
trucky/webhook 适用场景与选型建议
trucky/webhook 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11 次下载、GitHub Stars 达 1, 最近一次更新时间为 2023 年 06 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 trucky/webhook 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 trucky/webhook 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 11
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-06-03