PHPackages                             juststeveking/laravel-webhooks - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. juststeveking/laravel-webhooks

ActiveLibrary[API Development](/categories/api)

juststeveking/laravel-webhooks
==============================

A simple webhook implementation for Laravel.

0.0.51(2y ago)83163MITPHPPHP ^8.2

Since Apr 21Pushed 2y ago1 watchersCompare

[ Source](https://github.com/JustSteveKing/laravel-webhooks)[ Packagist](https://packagist.org/packages/juststeveking/laravel-webhooks)[ GitHub Sponsors](https://github.com/JustSteveKing)[ RSS](/packages/juststeveking-laravel-webhooks/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (6)Versions (7)Used By (0)

Laravel Webhooks
================

[](#laravel-webhooks)

[![Latest Version](https://camo.githubusercontent.com/c91d933f7d204b120dd36af574464662f047bfcb0f1b602ea45d5dc5c06070e5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a75737473746576656b696e672f6c61726176656c2d776562686f6f6b732e7376673f7374796c653d666c61742d737175617265266c6162656c3d72656c65617365)](https://packagist.org/packages/juststeveking/laravel-webhooks)[![Software License](https://camo.githubusercontent.com/6d11754b2abd230a3cb86162e04fadda942dc917d717fe2b21025f336e1bdac3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6a75737473746576656b696e672f6c61726176656c2d776562686f6f6b732e7376673f7374796c653d666c61742d737175617265)](https://github.com/juststeveking/laravel-webhooks/blob/main/LICENSE)[![Run Tests](https://github.com/JustSteveKing/laravel-webhooks/actions/workflows/tests.yml/badge.svg)](https://github.com/JustSteveKing/laravel-webhooks/actions/workflows/tests.yml)[![PHP Version](https://camo.githubusercontent.com/0a6aee7c54daf3ad67c26be4d1c048c588b46e7532f745b4542f04641bedad24/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6a75737473746576656b696e672f6c61726176656c2d776562686f6f6b732e7376673f7374796c653d666c61742d737175617265)](https://php.net)[![Total Downloads](https://camo.githubusercontent.com/598ad57ce8111373a887f619072eb2297949066d80599f4ec1bfe54b96e4fbdb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a75737473746576656b696e672f6c61726176656c2d776562686f6f6b732e7376673f7374796c653d666c61742d73717561726526636f6c6f72423d6d656469756d76696f6c6574726564)](https://packagist.org/packages/juststeveking/laravel-webhooks)

A simple webhook implementation for Laravel.

Installation
------------

[](#installation)

```
composer require juststeveking/laravel-webhooks
```

Publishing config
-----------------

[](#publishing-config)

To publish the configuration file for this package, please run the following artisan command:

```
php artisan vendor:publish --provider="JustSteveKing\Webhooks\Providers\PackageServiceProvider" --tag="webhooks"
```

The config looks for a few ENV variables that you can set:

- `WEBHOOK_HEADER` - The header key to send the signature as, this defaults to `Signature`
- `WEBHOOK_SIGNING_KEY` - Your webhook signing key.
- `WEBHOOK_USER_AGENT` - The user agent you want to set on your request, defaults to `Laravel_Webhooks`
- `WEBHOOK_TIMEOUT` - The request timeout you want to set for sending the webhook, defaults to 15 seconds.

Usage
-----

[](#usage)

Using the webhook facade all you need to pass through is the URL you want to send the webhook to.

```
use JustSteveKing\Webhooks\Facades\Webhook;

$webhook = Webhook::to(
    url: 'https://your-url.com/',
)
```

This will return a `PendingWebhook` for you to use. This will load the signing key in from your configuration.

If you need/want to set the signing key per-webhook you will need to instantiate the `PendingWebhook` yourself:

```
use JustSteveKing\Webhooks\Builder\PendingWebhook;
use JustSteveKing\Webhooks\Signing\WebhookSigner;

$webhook = new PendingWebhook(
    url: 'https://your-url.com/',
    signer: new WebhookSigner(
        key: 'your-signing-key',
    ),
);
```

The Pending Webhook has the following properties in the constructor:

- `url` - The URL you want to send the webhook to.
- `signer` - An instance of the webhook signer you want to use. This must implement the `SigningContract`.
- `payload` - You can pre-pass in the payload that you want to send in your webhook. This should be an `array`.
- `signed` - You can pre-pass in whether you want this webhook to be signed or not, the default is `true`.- `signature` - You can pre-pass in the signature that you want to use to sign your Webhooks with.
- `request` - You can pre-pass in a `PendingRequest` that you want to use to send your webhooks, this is useful when you need to attach an API token to your Webhooks.

A simple example
----------------

[](#a-simple-example)

In the below example, we are sending a webhook to `https://your-url.com/` and sending it the first `Post` model that we find.

```
use JustSteveKing\Webhooks\Facades\Webhook;

Webhook::to('https://your-url.com/')
    ->with(Post::query()->first()->toArray())
    ->send();
```

A more complex example
----------------------

[](#a-more-complex-example)

In this example we want to send a webhook to `https://your-url.com/`, again passing it the first `Post` model. However, this time we want to intercept the creation of the Request to attach the Bearer token for authentication. We then want to dispatch the sending of this webhook to the queue.

```
use Illuminate\Http\Client\PendingRequest;
use JustSteveKing\Webhooks\Facades\Webhook;

Webhook::to('https://your-url.com/')
    ->with(Post::query()->first()->toArray())
    ->intercept(fn (PendingRequest $request) => $request
        ->withToken('YOUR-BEARER-TOKEN'),
    )->queue('my-queue-name');
```

Not signing the webhook
-----------------------

[](#not-signing-the-webhook)

If you don't need to sign the webhook.

```
use JustSteveKing\Webhooks\Facades\Webhook;

Webhook::to('https://your-url.com/')->with(
    Post::query()->first()->toArray()
)->notSigned()->send();
```

Testing
-------

[](#testing)

To run the test:

```
composer run test
```

Credits
-------

[](#credits)

- [Steve McDougall](https://github.com/JustSteveKing)
- [All Contributors](../../contributors)

LICENSE
-------

[](#license)

The MIT License (MIT). Please see [License File](./LICENSE) for more information.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~8 days

Total

6

Last Release

1077d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a87fe82b349821ebd49cf57d65c4cd3e33ae0833222a8438d90fe8921ca899ea?d=identicon)[JustSteveKing](/maintainers/JustSteveKing)

---

Top Contributors

[![JustSteveKing](https://avatars.githubusercontent.com/u/6368379?v=4)](https://github.com/JustSteveKing "JustSteveKing (16 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/juststeveking-laravel-webhooks/health.svg)

```
[![Health](https://phpackages.com/badges/juststeveking-laravel-webhooks/health.svg)](https://phpackages.com/packages/juststeveking-laravel-webhooks)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
