GitHub DevLog AI GitHub DevLog AIPrivate webhook inbox for GitHub
← GitHub integrations
PHP

GitHub webhook with Laravel

Validate the raw body before transforming the payload and send heavy work to the queue.

Code sample

Webhook endpoint

Code samples, header names, event names, and signatures remain verbatim across locales.

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

Route::post('/webhooks/github', function (Request $request) {
    $body = $request->getContent();
    $sent = (string) $request->header('X-Hub-Signature-256');
    $expected = 'sha256='.hash_hmac('sha256', $body, config('services.github.webhook_secret'));
    abort_unless(hash_equals($expected, $sent), 401);

    ProcessGithubWebhook::dispatch(
        $request->header('X-GitHub-Delivery'),
        $request->header('X-GitHub-Event'),
        json_decode($body, true, flags: JSON_THROW_ON_ERROR),
    );
    return response()->noContent();
});
Setup steps

Verify the first delivery

Setup steps 1

Create a workspace in DevLog and copy the endpoint and Secret.

Setup steps 2

Configure the same Secret in GitHub and in your application’s secure environment variable.

Setup steps 3

Send a ping and confirm the signature, Delivery ID, and payload in the inbox.