承接 scito/eloquent-webhooks 相关项目开发

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

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

scito/eloquent-webhooks

最新稳定版本:1.01

Composer 安装命令:

composer require scito/eloquent-webhooks

包简介

Fire webhooks based on eloquent events

README 文档

README

Dispatch http requests on model events with zero configuration.

Installation

Install the package.

composer require scito/eloquent-webhooks 

Run the migration to create eloquent_webhooks table.

php artisan migrate 

If you don't have auto discovery add the service provider in config/app.php.

'providers' = [ Scito\EloquentWebhooks\Providers\WebhookServiceProvider::class, // ... ]; 

Configuration

Add the Webhooks trait in your model. Out of the box all published properties of your model will be available during the evaluation of the shortcodes in your webhook url.

use Illuminate\Database\Eloquent\Model; use Scito\EloquentWebhooks\Traits\Webhooks; class Post extends Model { use Webhooks; // ... } 

The shotcodes in a webhook will be evaluated against $model->toArray().

You can customize the data to evaluate by adding webhookData() in your model.

use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Scito\EloquentWebhooks\Models\EloquentWebhook; use Scito\EloquentWebhooks\Traits\Webhooks; class Post extends Model { use Webhooks; public function author(): BelongsTo { return $this->belongsTo(Author::class); } public function webhookData(EloquentWebhook $webhook): array { return [ 'title' => $this->name, 'author' => $this->author->name, ]; } // ... } 

Creating webhooks

use Scito\EloquentWebhooks\Models\EloquentWebhook; EloquentWebhook::create([ 'model' => Post::class, 'event' => 'created', 'status' => 'active', 'method' => 'get', 'link' => 'https://example.com?name={title}&author={author}', ]); 

You can also dispatch post requests, webhookData() / $model->toArray() will be sent as request payload.

use Scito\EloquentWebhooks\Models\EloquentWebhook; EloquentWebhook::create([ 'model' => Post::class, 'event' => 'created', 'status' => 'active', 'method' => 'post', 'link' => 'https://example.com', ]); 

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固