{"id":15625728,"url":"https://github.com/daniel15/laravel-webhooks","last_synced_at":"2025-08-10T04:40:24.450Z","repository":{"id":139345518,"uuid":"102288362","full_name":"Daniel15/laravel-webhooks","owner":"Daniel15","description":"Easily organize and secure your webhooks and map them to Laravel events.","archived":false,"fork":false,"pushed_at":"2017-09-10T19:11:15.000Z","size":22,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T17:14:44.636Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Daniel15.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-03T19:17:47.000Z","updated_at":"2024-04-24T09:58:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"2f31bce9-354c-4cf6-aa95-4195c000d714","html_url":"https://github.com/Daniel15/laravel-webhooks","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Daniel15/laravel-webhooks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Daniel15%2Flaravel-webhooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Daniel15%2Flaravel-webhooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Daniel15%2Flaravel-webhooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Daniel15%2Flaravel-webhooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Daniel15","download_url":"https://codeload.github.com/Daniel15/laravel-webhooks/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Daniel15%2Flaravel-webhooks/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269677505,"owners_count":24457857,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T10:02:23.342Z","updated_at":"2025-08-10T04:40:24.429Z","avatar_url":"https://github.com/Daniel15.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel Webhooks\n\nThis Laravel package helps you organize, secure and map webhooks to events.\n\n### Installation\n\nTo get started, install Laravel Webhooks via the Composer package manager:\n\n```\ncomposer require obrignoni/webhooks\n```\n\nNext, register the Webhooks service provider in the providers array of your config/app.php configuration file:\n\n```\nObrignoni\\Webhooks\\WebhooksServiceProvider::class,\n```\n\n### Why a webhooks package? \n\nI want to...\n\n1. integrate my applications with webhooks from multiple services.\n2. keep the webhooks organized and secure.\n3. map webhook events to Laravel events.\n\n### Usage\n\nLets take [Github Webhooks](https://developer.github.com/webhooks/) for example. \n\nA Github webhook payload looks like this...\n\n```\nPOST /payload HTTP/1.1\n\nHost: localhost:4567\nX-Github-Delivery: 72d3162e-cc78-11e3-81ab-4c9367dc0958\nUser-Agent: GitHub-Hookshot/044aadd\nContent-Type: application/json\nContent-Length: 6615\nX-GitHub-Event: issues\n\n{\n  \"action\": \"opened\",\n  \"issue\": {\n    \"url\": \"https://api.github.com/repos/octocat/Hello-World/issues/1347\",\n    \"number\": 1347,\n    ...\n  },\n  \"repository\" : {\n    \"id\": 1296269,\n    \"full_name\": \"octocat/Hello-World\",\n    \"owner\": {\n      \"login\": \"octocat\",\n      \"id\": 1,\n      ...\n    },\n    ...\n  },\n  \"sender\": {\n    \"login\": \"octocat\",\n    \"id\": 1,\n    ...\n  }\n}\n```\n\nNotice the `X-GitHub-Event` header contains `issues`, one of [Github Events](https://developer.github.com/webhooks/#events).\n\nWe can use an artisan command to setup a webhook for github.\n\n```\nphp artisan make:webhook github\n```\n\nThis will create the `App\\Http\\Webhooks\\Github` class.\n \nThe webhook class extends a WebhookRequest which also extends a \nFormRequest and adds a couple of extra configuration options.\n\nLets take a look at the generated class.\n\n```php\n\u003c?php namespace App\\Http\\Webhooks;\n\nuse Obrignoni\\Webhooks\\Http\\WebhookRequest;\n\nclass Github extends WebhookRequest\n{\n\n    protected $eventField = '';\n\n    protected $events = [];\n\n    protected $authorization = null;\n\n    public function authorize()\n    {\n        // Authorize the webhook the same way you would with a FormRequest.\n\n        return false;\n    }\n\n    public function rules()\n    {\n        return [\n\n        ];\n    }\n\n}\n```\n\nWe can setup our Github webhook like this...\n\n```php\n\u003c?php namespace App\\Http\\Webhooks;\n\nuse Obrignoni\\Webhooks\\Authorization\\GithubAuthorization;\nuse Obrignoni\\Webhooks\\Http\\WebhookRequest;\n\nclass Github extends WebhookRequest\n{\n\n    protected $eventField = 'X-GitHub-Event';\n\n    protected $authorization = GithubAuthorization::class;\n\n}\n```\n\n## Event Field\n\nThe event field is the request parameter or header that contains the event value.\n\n### Authorization Handler\n\nThe authorization handler can contain the logic to authorize the request. It should return a boolean value.\n\nThe `$authorization` is set to the `GithubAuthorization` handler that is included with this package. \nUsing an authorization handler is optional and it can be used in lieu of the authorize.\n\n### Mapped Events\n\nYou use the `$events` array to map each webhook event to an event class. If left empty, event names will be automatically \ntransformed to studly cased classes. For a Github webhook, the `pull_request` event will be transformed to \n`App\\Events\\GithubPullRequest`.\n\nHere as an example of how to set up custom events.\n\n```php\n\u003c?php namespace App\\Http\\Webhooks;\n\nuse Obrignoni\\Webhooks\\Authorization\\GithubAuthorization;\nuse Obrignoni\\Webhooks\\Http\\WebhookRequest;\n\nclass Github extends WebhookRequest\n{\n\n    protected $field = 'X-GitHub-Event';\n\n    protected $authorization = GithubAuthorization::class;\n\n    protected $events = [\n        'issue_comment' =\u003e 'App\\Events\\SomebodyMadeACommentOnGithub',  \n        'pull_request' =\u003e 'App\\Events\\SomebodySubmittedAPullRequest',  \n    ];\n\n}\n```\n\n### Webhook Requests Extend Form Requests\n\nYou have the option of using the `authorize` and `rules` methods just like [Form Requests](https://laravel.com/docs/5.3/validation#form-request-validation).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaniel15%2Flaravel-webhooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaniel15%2Flaravel-webhooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaniel15%2Flaravel-webhooks/lists"}