PHPackages                             dniccum/nova-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. [DevOps &amp; Deployment](/categories/devops)
4. /
5. dniccum/nova-webhooks

ActiveLibrary[DevOps &amp; Deployment](/categories/devops)

dniccum/nova-webhooks
=====================

A tool for Laravel's Nova administrator panel that enables users to create webhooks that can be customized to fire on specified Eloquent model events (created, updated, etc). This allows applications to communicate with other applications and integrations (Zapier, If This Then That, etc).

v2.0.0(1y ago)188.5k—0%5[2 issues](https://github.com/dniccum/nova-webhooks/issues)[1 PRs](https://github.com/dniccum/nova-webhooks/pulls)MITPHPPHP ^8.1

Since Feb 18Pushed 1y ago1 watchersCompare

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

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

Webhook Manager for Laravel Nova
================================

[](#webhook-manager-for-laravel-nova)

A Laravel Nova tool that allows users to create and manage webhooks based on Eloquent Model events.

[![Nova Webhooks](https://github.com/dniccum/nova-webhooks/raw/main/assets/nova-webhooks-social-image.png?raw=true)](https://github.com/dniccum/nova-webhooks/blob/main/assets/nova-webhooks-social-image.png?raw=true)

[![Latest Version on Packagist](https://camo.githubusercontent.com/7db049508d7b1f5423d52fe23d84fb9049658e8b018ccbff3c6551cb5ca7b35c/68747470733a2f2f706f7365722e707567782e6f72672f646e696363756d2f6e6f76612d776562686f6f6b732f762f737461626c653f666f726d61743d666c61742d73717561726526636f6c6f723d23304537464330)](https://packagist.org/packages/dniccum/nova-webhooks)[![License](https://camo.githubusercontent.com/f163b727c222702c44fd0513b1652b5002b23933da78635981ec9ce969c1ef88/68747470733a2f2f706f7365722e707567782e6f72672f646e696363756d2f6e6f76612d776562686f6f6b732f6c6963656e73653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/dniccum/nova-webhooks)[![Total Downloads](https://camo.githubusercontent.com/9a26f236ff1ea69662990fcfe206cb927cad5a0cb64d27e2c2933d9ae05c9df8/68747470733a2f2f706f7365722e707567782e6f72672f646e696363756d2f6e6f76612d776562686f6f6b732f646f776e6c6f6164733f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/dniccum/nova-webhooks)

A tool for Laravel's Nova administrator panel that enables users to create webhooks that can be customized to fire on specified Eloquent model events (created, updated, etc). This allows applications to communicate with other applications and integrations (Zapier, If This Then That, etc).

This tool also includes a useful logging feature that will log any successful/failed webhooks to help with metrics and debugging.

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
    - [Migrations](#migrations)
    - [File Additions](#file-additions)
- [Configuration](#configuration)
- [Implementing the Tool](#implementing-the-tool)
    - [Nova Resource](#nova-resource)
    - [Model Traits](#model-traits)
    - [Customizing the Payload](#customizing-the-payload)
    - [Model Label](#model-label)
    - [Sending Webhooks to a Queue](#sending-webhooks-to-a-queue)
- [Using the Tool](#using-the-tool)
    - [Webhook Secret](#webhook-secret)
    - [Authorization](#authorization)
    - [Testing Action](#testing-action)
    - [Logging](#logging)
- [Testing and Development](#testing-and-development)

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

[](#installation)

You can install the package via composer:

```
composer require dniccum/nova-webhooks
```

You will then need to publish the package's assets to your application:

```
php artisan vendor:publish --provider="Dniccum\NovaWebhooks\ToolServiceProvider"
```

Doing this action will add the following items:

- migrations
- configuration files *(Note: there will be two)*
- translations

### Migrations

[](#migrations)

Perform your database migrations via artisan command:

```
php artisan migrate
```

### File Additions

[](#file-additions)

There are two things that you will need to add to your application's `NovaServiceProvider.php`:

#### Addition 1 - Resource Trait

[](#addition-1---resource-trait)

To inform Nova of the new resource that exists outside of the Nova directory within the application, we need to add a trait to the `NovaServiceProvider` class:

```
use Dniccum\NovaWebhooks\Nova\UsesWebhookResource;

...

class NovaServiceProvider extends NovaApplicationServiceProvider
{
    // Add the following trait to your service provider
    use UsesWebhookResource;

}
```

#### Addition 2 - Tool Registration

[](#addition-2---tool-registration)

Finally, you will need to register the tool within the NovaServiceProvider.php:

```
use Dniccum\NovaWebhooks\NovaWebhooks;

...

/**
 * Get the tools that should be listed in the Nova sidebar.
 *
 * @return array
 */
public function tools()
{
    return [
        // other tools
        new NovaWebhooks,
    ];
}
```

Configuration
-------------

[](#configuration)

Two different configuration files are published with this package; one for this package (`nova-webhooks.php`) and one for the webhook server (`webhook-server.php`) that this package utilizes.

This package relies on [Spatie's webhook server package](https://github.com/spatie/laravel-webhook-server) to dispatch each webhook request. Feel free to configure the server to your needs using the associated documentation.

### Available Configuration Settings

[](#available-configuration-settings)

Available configuration settings for this tool:

```
return [

    /**
     * Whether webhooks should be sent
     */
    'enabled' => env('NOVA_WEBHOOKS_ENABLED', true),

    /**
     * If logging should be enabled for each successful/failed request
     */
    'logging' => [
        'enabled' => env('NOVA_WEBHOOKS_LOGGING_ENABLED', true),
    ],

    /**
     * Enter the desired formatting for timestamps that are attached to logging.
     * See the official PHP documentation for more information: https://www.php.net/manual/en/datetime.format.php
     */
    'date_format' => 'Y-m-d @ G:i',

    /**
     * The Laravel Nova resource that manages your authenticated users.
     */
    'users' => [
        'resource' => App\Nova\User::class
    ]

];
```

Implementing the Tool
---------------------

[](#implementing-the-tool)

While this package is not necessarily "plug-and-play," it has been designed to only require minor amounts of code to get your webhooks up and running.

### Nova Resource

[](#nova-resource)

The Webhook resource that is part of this tool will automatically be registered within Nova due to the trait that was added during setup process.

### Model Traits

[](#model-traits)

The main functionality of this tool is to listen to native Eloquent model events and passes a JSON-serialized payload of that model's attributes. A series traits are available for you to enable different actions and customize that hook's payload.

This package provides 4 different traits that you can add to each of your Eloquent models:

- `Dniccum\NovaWebhooks\Traits\CreatedWebhook`
- `Dniccum\NovaWebhooks\Traits\UpdatedWebhook`
- `Dniccum\NovaWebhooks\Traits\DeletedWebhook`
- `Dniccum\NovaWebhooks\Traits\AllWebhooks`

Each trait, with exception for the last (which is a shortcut to include all available traits), is associated with the event that it listens for; `CreatedWebhook` for the created Eloquent event and so on and so forth.

#### Customizing the Payload

[](#customizing-the-payload)

Additionally, each trait provides a corresponding method to modify the payload that is sent with each webhook. See below for the name of the trait with the matching name of the method:

TraitMethod`CreatedWebhook``createdWebhookPayload``UpdatedWebhook``updatedWebhookPayload``DeleteddWebhook``deletedWebhookPayload`By default, this package will send a serialized array of the model that extends one of these traits. However you do have the ability to modify this behavior.

##### Custom Array

[](#custom-array)

Return an associative array of valid key/value pairs based on the `$model` parameter.

```
protected static function createdWebhookPayload($model)
{
    return [
        'id' => $model->id,
        'name' => $model->first_name.' '.$model->last_name,
        'email' => $model->email,
        // And so on
    ];
}
```

##### JSON Resource

[](#json-resource)

You also have the ability to return a [Laravel-generated JSON resource](https://laravel.com/docs/9.x/eloquent-resources) and customize this object to your liking:

**JSON Resource**

```
class PageLikeResource extends \Illuminate\Http\Resources\Json\JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'id' => $this->id,
            'name' => $this->first_name.' '.$this->last_name,
            'email' => $this->email,
        ];
    }
}
```

**Eloquent Model**

```
protected static function createdWebhookPayload($model)
{
    return new PageLikeResource($model);
}
```

#### Model Label

[](#model-label)

Each trait also exposes a method that will configure how the model displays within the Nova interface. By default Nova will show the namespaced string of the Model followed by the associated action; for instance `App\Models\User:updated`.

If you would like to change it to something else a little more user-friendly, or even use a translation key, you can modify it like so:

```
/**
 * The name of the model that will be applied to the webhook
 *
 * @return string
 */
public static function webhookLabel() : string
{
    return 'App Users';
}
```

Setting the label to *App Users* will show the following in the Nova action: `App Users:updated`.

#### Sending Webhooks to a Queue

[](#sending-webhooks-to-a-queue)

When an Eloquent Model executes a webhook call, the [webhook server package](https://github.com/spatie/laravel-webhook-server#usage) that helps power this tool will automatically send the webhook to the configured queue. In the case that you might be hydrating additional relationships and/or other logic while generating your payload, it might be more performant to send the execution of the webhook to the queue as well.

To do this, simply add the `ShouldQueueWebhook` trait to the top of your model, like so:

```
use Dniccum\NovaWebhooks\Jobs\DispatchWebhook;

class PageLike extends \Illuminate\Database\Eloquent\Model
{
    use ShouldQueueWebhook

    ...
}
```

This adds both a property and an additional method to your model:

```
/**
 * The job class that should be used to dispatch this model's webhook
 *
 * @var string
 */
public static $job = DispatchWebhook::class;

/**
 * @return bool
 */
public static function queueWebhook() : bool
{
    return true;
}
```

The property gives you the ability to override the Job class that is called when executing the webhook. For most cases this should not have to be changed, but it is available if necessary. Furthermore, you also have the ability to write custom logic to whether or not send the webhook to the queue at all. Again, most likely you shouldn't have to change this.

Using the Tool
--------------

[](#using-the-tool)

### Webhook Secret

[](#webhook-secret)

The fields that the "baked-in" Webhook resource provides are relatively self-explanatory. All fields are required except for the hook's secret key. This will be auto-generated for you if you do not provide one your self. In most cases, your webhooks will not need a secret key for validation; both Zapier and IFTTT do not require any authorization.

In the circumstance that you are using a package/service like [Spatie's webhook client](https://github.com/spatie/laravel-webhook-client), it is usually recommended (per their documentation) that you use a key authorize your application's webhook endpoints to prevent any unwanted requests. Again, you can either use the auto-generated hash that this package provides, or you can enter your own.

### Authorization

[](#authorization)

Due to the fact the Webhook resource that is made available to the application via this package, you can provide user/role authorization using a [conventional Eloquent Model policy](https://laravel.com/docs/9.x/authorization#policy-methods). Refer to the [Nova documentation](https://nova.laravel.com/docs/3.0/resources/authorization.html) for additional information.

### Testing Action

[](#testing-action)

Probably the most important part of any webhook is testing and validation that your webhook is working correctly and providing the necessary information to the prescribed endpoint. This package gives you the ability to do such an action based on the Eloquent events that you have selected for this webhook. Simply select the hook that you want to test and then utilize the Nova Actions toolbar or the inline button to launch the testing action, and then indicate which model and corresponding model event that you want to test.

[![Action Modal](https://github.com/dniccum/nova-webhooks/raw/main/assets/action-modal.png?raw=true)](https://github.com/dniccum/nova-webhooks/blob/main/assets/action-modal.png?raw=true)

#### Sample Data

[](#sample-data)

When you want execute a test, this package will pull a random entry in the selected model's table in your database and use it as the subject for your webhook. If you don't have any records available yet, the action will throw an error instructing you to add the necessary records before you proceed.

### Logging

[](#logging)

Unless specifically configured (as seen above), this tool will log successful and failed webhook operations. Successful events are simply stored for analytics purposes and are then displayed with some simple accompanying charts.

[![Resource Analytics](https://github.com/dniccum/nova-webhooks/raw/main/assets/resource-analytics.png?raw=true)](https://github.com/dniccum/nova-webhooks/blob/main/assets/resource-analytics.png?raw=true)

If the desired endpoint that your webhooks are pointed throws an error, this tool will capture the response and log it accordingly. You can then view the associated error message within the Webhook that was created.

Testing and Development
-----------------------

[](#testing-and-development)

To perform the necessary PHP Unit tests using the Orchestra Workbench, clone the repository, install the necessary dependencies with `composer install` and run the PHP Unit testing suite:

```
./vendor/bin/phpunit
```

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~172 days

Recently: every ~226 days

Total

7

Last Release

516d ago

Major Versions

v0.1.0 → v1.0.02022-03-04

v1.1.3 → v2.0.02024-12-18

PHP version history (2 changes)v0.1.0PHP ^7.4|^8.0

v2.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/9fe997126bcc6a6026a2f6c335ce125055af46178c82faa24d3087b7d5dc0b44?d=identicon)[dniccum](/maintainers/dniccum)

---

Top Contributors

[![jansgescheit](https://avatars.githubusercontent.com/u/21027386?v=4)](https://github.com/jansgescheit "jansgescheit (6 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")[![dniccum](https://avatars.githubusercontent.com/u/2816415?v=4)](https://github.com/dniccum "dniccum (4 commits)")[![neyaoz](https://avatars.githubusercontent.com/u/4792515?v=4)](https://github.com/neyaoz "neyaoz (3 commits)")

---

Tags

laravelnovatoolwebhooklaravelserverwebhooksnova

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dniccum-nova-webhooks/health.svg)

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

###  Alternatives

[pragmarx/health

Laravel Server &amp; App Health Monitor and Notifier

2.0k1.0M2](/packages/pragmarx-health)[renoki-co/laravel-healthchecks

Laravel Healthchecks is a simple controller class that helps you build your own healthchecks endpoint without issues.

5654.9k](/packages/renoki-co-laravel-healthchecks)[thiagof/laravelrpc

JsonRPC Client/Server services for Laravel 5

337.5k](/packages/thiagof-laravelrpc)[wrklst/pulse-remote-server

A Laravel Pulse Recorder for Remote Servers

1316.1k](/packages/wrklst-pulse-remote-server)

PHPackages © 2026

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