{"id":18879738,"url":"https://github.com/loilo/github-webhook-handler","last_synced_at":"2026-04-27T08:32:04.304Z","repository":{"id":62518764,"uuid":"257001108","full_name":"loilo/github-webhook-handler","owner":"loilo","description":"🏴‍☠️ Validate and utilize GitHub webhooks","archived":false,"fork":false,"pushed_at":"2026-04-11T20:26:56.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-04-11T22:17:51.186Z","etag":null,"topics":["github","webhook"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/loilo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-19T13:04:47.000Z","updated_at":"2026-04-11T20:27:03.000Z","dependencies_parsed_at":"2022-11-02T13:17:59.166Z","dependency_job_id":null,"html_url":"https://github.com/loilo/github-webhook-handler","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/loilo/github-webhook-handler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loilo%2Fgithub-webhook-handler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loilo%2Fgithub-webhook-handler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loilo%2Fgithub-webhook-handler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loilo%2Fgithub-webhook-handler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/loilo","download_url":"https://codeload.github.com/loilo/github-webhook-handler/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loilo%2Fgithub-webhook-handler/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32329463,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T23:26:28.701Z","status":"online","status_checked_at":"2026-04-27T02:00:06.769Z","response_time":128,"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":["github","webhook"],"created_at":"2024-11-08T06:39:05.945Z","updated_at":"2026-04-27T08:32:04.282Z","avatar_url":"https://github.com/loilo.png","language":"PHP","readme":"\u003cdiv align=\"center\"\u003e\n  \u003cbr\u003e\n  \u003cimg width=\"180\" src=\"hook.svg\" alt=\"Hook\"\u003e\n  \u003cbr\u003e\n  \u003cbr\u003e\n\n  # GitHub Webhook Handler\n\n\u003c/div\u003e\n\n[![Tests](https://badgen.net/github/checks/loilo/github-webhook-handler/master)](https://github.com/loilo/github-webhook-handler/actions)\n[![Packagist](https://badgen.net/packagist/v/loilo/github-webhook-handler)](https://packagist.org/packages/loilo/github-webhook-handler)\n\nHandle GitHub webhooks with PHP.\n\n## Installation\n```bash\ncomposer require loilo/github-webhook-handler\n```\n\n## Usage\nStart by creating a handler:\n\n```php\n$handler = new Loilo\\GithubWebhook\\Handler($secret);\n```\n\n`$secret` is the webhook secret defined in the GitHub backend. It *can* be omitted, however providing it is *strongly recommended* to prevent abuse of the endpoint.\n\nTo handle a request (specifically, a [PSR-7 `ServerRequestInterface`](https://www.php-fig.org/psr/psr-7/#321-psrhttpmessageserverrequestinterface)), pass that request to the `handle` method:\n\n```php\n$delivery = $handler-\u003ehandle($request);\n```\n\nIf the webhook request is invalid, [a failure-specific exception](src/Exceptions) will be thrown. Otherwise, the method returns a [`Delivery`](src/Delivery.php) object which provides access to the event that caused the hook request and to the payload data that was sent along with it:\n\n```php\n// Get the triggered event (e.g. 'push')\n$delivery-\u003eevent();\n\n// Get the whole webhook payload as an associative array\n$delivery-\u003epayload();\n\n// Get a nested path in the payload (returns `null` if the path doesn't exist)\n$delivery-\u003epayload('repository.full_name');\n```\n\n### Single-File Endpoint\n\nThere may be very simple cases where you're not using a PHP framework for your script and just want to put a single PHP file endpoint out there. To avoid having to deal with exceptions and creating appropriate error responses, you may use the `respond()` method:\n\n```php\n$delivery = $handler-\u003erespond($request);\n```\n\nNow you can safely use the `$delivery` object without any further worries — if validation of the webhook request fails, the handler will set an appropriate HTTP status code, print the error message and [stop script execution](https://php.net/manual/en/function.exit.php).\n\n\u003e **Pro Tip:** Not having a PSR-7 request object at hand? Install the [`guzzlehttp/psr7`](https://github.com/guzzle/psr7) package and use `\\GuzzleHttp\\Psr7\\ServerRequest::fromGlobals()` to create a request object from the environment.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floilo%2Fgithub-webhook-handler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Floilo%2Fgithub-webhook-handler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floilo%2Fgithub-webhook-handler/lists"}