digitlimit/githook
Composer 安装命令:
composer require digitlimit/githook
包简介
A Laravel package to handle GitHub webhooks seamlessly by dispatching Laravel events for all GitHub events. Users can listen to and handle these events easily.
关键字:
README 文档
README
A Laravel package to handle GitHub webhooks seamlessly by dispatching Laravel events for all GitHub events. Users can listen to and handle these events easily.
Installation
To install the package, use Composer:
composer require digitlimit/githook
Configuration
Publish Configuration File To publish the configuration file, run:
php artisan vendor:publish --provider="Digitlimit\Githook\GithookServiceProvider"
Configure Environment Variables
Add the following environment variables to your .env file:
GITHOOK_SECRET=your-github-webhook-secret
Available Events
Here are the events you can subscribe to:
use Digitlimit\Githook\Events\BranchProtectionConfiguration;
use Digitlimit\Githook\Events\BranchProtectionRule;
use Digitlimit\Githook\Events\CheckRun;
use Digitlimit\Githook\Events\CheckSuite;
use Digitlimit\Githook\Events\CodeScanningAlert;
use Digitlimit\Githook\Events\CommitComment;
use Digitlimit\Githook\Events\Create;
use Digitlimit\Githook\Events\CustomProperty;
use Digitlimit\Githook\Events\CustomPropertyValues;
use Digitlimit\Githook\Events\Delete;
use Digitlimit\Githook\Events\DependabotAlert;
use Digitlimit\Githook\Events\DeployKey;
use Digitlimit\Githook\Events\Deployment;
use Digitlimit\Githook\Events\DeploymentProtectionRule;
use Digitlimit\Githook\Events\DeploymentReview;
use Digitlimit\Githook\Events\DeploymentStatus;
use Digitlimit\Githook\Events\Discussion;
use Digitlimit\Githook\Events\DiscussionComment;
use Digitlimit\Githook\Events\Fork;
use Digitlimit\Githook\Events\GithubAppAuthorization;
use Digitlimit\Githook\Events\Gollum;
use Digitlimit\Githook\Events\Installation;
use Digitlimit\Githook\Events\InstallationRepositories;
use Digitlimit\Githook\Events\InstallationTarget;
use Digitlimit\Githook\Events\IssueComment;
use Digitlimit\Githook\Events\Issues;
use Digitlimit\Githook\Events\Label;
use Digitlimit\Githook\Events\MarketplacePurchase;
use Digitlimit\Githook\Events\Member;
use Digitlimit\Githook\Events\Membership;
use Digitlimit\Githook\Events\MergeGroup;
use Digitlimit\Githook\Events\Meta;
use Digitlimit\Githook\Events\Milestone;
use Digitlimit\Githook\Events\OrgBlock;
use Digitlimit\Githook\Events\Organization;
use Digitlimit\Githook\Events\Package;
use Digitlimit\Githook\Events\PageBuild;
use Digitlimit\Githook\Events\PersonalAccessTokenRequest;
use Digitlimit\Githook\Events\Ping;
use Digitlimit\Githook\Events\Project;
use Digitlimit\Githook\Events\ProjectCard;
use Digitlimit\Githook\Events\ProjectColumn;
use Digitlimit\Githook\Events\ProjectsV2;
use Digitlimit\Githook\Events\ProjectsV2Item;
use Digitlimit\Githook\Events\ProjectsV2StatusUpdate;
use Digitlimit\Githook\Events\PublicEvent;
use Digitlimit\Githook\Events\PullRequest;
use Digitlimit\Githook\Events\PullRequestReview;
use Digitlimit\Githook\Events\PullRequestReviewComment;
use Digitlimit\Githook\Events\PullRequestReviewThread;
use Digitlimit\Githook\Events\Push;
use Digitlimit\Githook\Events\RegistryPackage;
use Digitlimit\Githook\Events\Release;
use Digitlimit\Githook\Events\Repository;
use Digitlimit\Githook\Events\RepositoryAdvisory;
use Digitlimit\Githook\Events\RepositoryDispatch;
use Digitlimit\Githook\Events\RepositoryImport;
use Digitlimit\Githook\Events\RepositoryRuleset;
use Digitlimit\Githook\Events\RepositoryVulnerabilityAlert;
use Digitlimit\Githook\Events\SecretScanningAlert;
use Digitlimit\Githook\Events\SecretScanningAlertLocation;
use Digitlimit\Githook\Events\SecurityAdvisory;
use Digitlimit\Githook\Events\SecurityAndAnalysis;
use Digitlimit\Githook\Events\Sponsorship;
use Digitlimit\Githook\Events\Star;
use Digitlimit\Githook\Events\Status;
use Digitlimit\Githook\Events\SubIssues;
use Digitlimit\Githook\Events\Team;
use Digitlimit\Githook\Events\TeamAdd;
use Digitlimit\Githook\Events\Watch;
use Digitlimit\Githook\Events\WorkflowDispatch;
use Digitlimit\Githook\Events\WorkflowJob;
use Digitlimit\Githook\Events\WorkflowRun;
use Digitlimit\Githook\Events\Generic;
Subscribing to Events
You can subscribe to events either in the Laravel Event Service Provider or directly in the configuration file.
Using Event Service Provider
To subscribe to events in the Event Service Provider, add the following to your app/Providers/EventServiceProvider.php:
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Digitlimit\Githook\Events\Star;
use App\Listeners\HandleStar;
class EventServiceProvider extends ServiceProvider
{
protected $listen = [
Star::class => [
HandleStar::class,
],
];
public function boot()
{
parent::boot();
}
}
Using the Configuration File
Alternatively, you can subscribe to events directly in the configuration file config/githook.php:
return [
'events' => [
'star' => [
'event' => Events\Star::class,
'listeners' => [
\App\Listeners\HandleStar::class,
],
],
],
...
];
Example Listener
Here is an example listener for the Star event:
namespace App\Listeners;
use Digitlimit\Githook\Events\Star;
class HandleStar
{
public function handle(Star $event)
{
// Handle the event
}
}
How to setup webhook in GitHub
- Setup Github Webhook if you have not done so. https://github.com/your-username/your-repo/settings/hooks
Testing
composer install php vendor/bin/testbench package:test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email frankemeks77@yahoo.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
digitlimit/githook 适用场景与选型建议
digitlimit/githook 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 666 次下载、GitHub Stars 达 5, 最近一次更新时间为 2021 年 10 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「github」 「laravel」 「webhook」 「githook」 「Laravel events」 「digitlimit」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 digitlimit/githook 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 digitlimit/githook 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 digitlimit/githook 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Handles basic OAuth/OAuth2 authentication along with classes for common services
MediaWiki extension that allows embedding external content, specified by URL, into your wiki pages
Inbox pattern process implementation for your Laravel Applications
Laravel package for the simplification and integration of many of your users most wanted login providers. Installation is a breeze. Never worry about OAuth again.
GitHub Webhook Listener with plugin-based API for creating your own triggerered actions
统计信息
- 总下载量: 666
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-10-18
