定制 oanhnn/laravel-webhook-shield 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

oanhnn/laravel-webhook-shield

Composer 安装命令:

composer require oanhnn/laravel-webhook-shield

包简介

Protects against unverified webhooks from 3rd party services on Laravel 5.5+

README 文档

README

Latest Version Software License Build Status Coverage Status Total Downloads Requires PHP

Protects against unverified webhooks from 3rd party services on Laravel 5.5+

Features

  • Supported Laravel 5.5+
  • Allow multi services with same driver (Useful for two webhook endpoints of two facebook applications)
  • Supported drivers
    • Bitbucket
    • Facebook
    • Github
    • Gitlab
    • Mailgun
    • Shopify
    • Trello
  • Easy to extend more drivers

Requirements

  • php >=7.1.3
  • Laravel 5.5+

Laravel 6.0+ required php 7.2+

Installation

Begin by pulling in the package through Composer.

$ composer require oanhnn/laravel-webhook-shield

The package will automatically register itself.
You can publish the config-file with:

$ php artisan vendor:publish --provider=Laravel\WebhookShield\ServiceProvider

Usage

Configure services

In configuration file, you can define services

<?php

return [
    'services' => [
        'github' => [
            'driver' => 'github',
            'options' => [],
        ],
        'facebook' => [
            'driver' => \Laravel\WebhookShield\Services\Facebook::class,
            'options' => [],
        ],
        'custom' => [
            'driver' => 'custom-driver',
            'options' => [],
        ],
    ],
];

Protects webhook routes

Route::middleware('shield:facebook')->post('/webhook/facebook', 'WebhookController@facebook');
Route::middleware('shield:github')->post('/webhook/facebook', 'WebhookController@github');
Route::middleware('shield:custom')->post('/webhook/custom', 'WebhookController@custom');

Make custom driver

Make a service implement class

<?php
namespace App\Services;

use Laravel\WebhookShield\Contracts\Service;

class CustomService implements Service
{
    // ...
}

And register this driver in app/Providers/AppServiceProvider.php

<?php
namespace App\Providers;

use App\Services\CustomService;
use Illuminate\Support\ServiceProvider;
use Laravel\WebhookShield\Facades\Shield;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        Shield::extend('custom-driver', function ($app, $config) {
            return new CustomService($config);
        });
        // ...
    }
    
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        // ...
    }
}

Changelog

See all change logs in CHANGELOG

Testing

$ git clone git@github.com/oanhnn/laravel-webhook-shield.git /path
$ cd /path
$ composer install
$ composer phpunit

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email to Oanh Nguyen instead of using the issue tracker.

Credits

License

This project is released under the MIT License.
Copyright © 2018-2019 Oanh Nguyen.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-12-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固