PHPackages                             doohlabs/yii2-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. doohlabs/yii2-webhooks

ActiveYii2-extension[API Development](/categories/api)

doohlabs/yii2-webhooks
======================

Yii2 extension for webhooks

1.0.5(4y ago)0324MITPHPPHP &gt;=7.1.0

Since Nov 30Pushed 4y agoCompare

[ Source](https://github.com/doohlabs/yii2-webhooks)[ Packagist](https://packagist.org/packages/doohlabs/yii2-webhooks)[ RSS](/packages/doohlabs-yii2-webhooks/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (3)Versions (7)Used By (0)

Yii2 Webhooks
=============

[](#yii2-webhooks)

Extension for creating and using web-hooks in yii2.

Description
-----------

[](#description)

Add webhooks and attach them to `ActiveRecord` objects' events to trigger HTTP requests to external systems (3rd party services, your own applications etc.).

### Use case example

[](#use-case-example)

Let's assume that inside your project you have an `Example` class which extends `ActiveRecord`.

If you want to trigger a webhook every time a new `Example` record is created, you will create a new `Webhook` record, and assign it to your `Example` class.

You do this by setting the `event` attribute of the `Webhook` record to value of `app\models\Example::EVENT_AFTER_CREATE`. You also set the webhook `url` and `method` values. For example `http://api.service.com` and `POST`.

Now, every time a new `Example` record is created inside your project, your api service receives an http request with the `Example` object attributes.

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Run composer installation.

```
composer require --prefer-dist doohlabs/yii2-webhooks "^1.0"
```

Setup
-----

[](#setup)

Run the migration. It creates the *webhook* and *webhook\_log* tables.

```
php yii migrate --migrationPath=@doohlabs/webhooks/migrations
```

The extension needs to be bootstrapped:

```
'bootstrap' => [
    // ...
    'webhooks'
],
```

Add the module to the config:

```
'modules' => [
    // ...
    'webhooks' => [
        'class' => 'doohlabs\webhooks\Module',
        'allowedModels' => [
            'app\models\Model1',
            'app\models\Model2',
        ],
        'allowedEvents' => [
            'EVENT_AFTER_DELETE',
            'EVENT_AFTER_INSERT',
            'EVENT_AFTER_UPDATE',
        ],
        'timeout' => 30,
    ],
],
```

Usage
-----

[](#usage)

### Webhooks

[](#webhooks)

Create a new webhook by navigating to the *webhooks* module: `index.php?r=webhooks/webhook/create`

You can use the predefined events from `BaseActiveRecord` class, e.g. `EVENT_AFTER_INSERT` or you can use your own events, e.g. `app\models\Example::EVENT_EXAMPLE`.

The model must implement \\doohlabs\\webhooks\\interfaces\\WebhookModelInterface.

### User generated events

[](#user-generated-events)

When triggering your custom event, make sure you **send the instantiated model** like in the following code:

```
Event::trigger(Example::class, Example::EVENT_EXAMPLE, new Event(['sender' => $model]));
```

### Logger

[](#logger)

Extension logs every triggered webhook with its http request and response.

Logs are available at `index.php/webhooks?r=/webhook-log/index`

Implementing your own EventDispatcher
-------------------------------------

[](#implementing-your-own-eventdispatcher)

You can add your own implementation of the event dispatcher to fit your needs. It must implement `EventDispatcherInterface`.

Config needs to be updated accordingly:

```
'modules' => [
    // ...
    'webhooks' => [
        'class' => 'doohlabs\webhooks\Module',
        'eventDispatcherComponentClass' => 'app\components\MyDispatcher',
    ],
],
```

Implementing your own Webhook
-----------------------------

[](#implementing-your-own-webhook)

TBD

Screenshots
-----------

[](#screenshots)

[![Image of webhook index page](docs/images/screenshot-webhook-index.png)](docs/images/screenshot-webhook-index.png)

[![Image of webhook-log index page](docs/images/screenshot-webhook-log-index.png)](docs/images/screenshot-webhook-log-index.png)

Contributing
------------

[](#contributing)

Your local setup should have this repository and an existing yii2 project (preferably a clean yii2 template).

Link the repo to your project by adding it to your project's `composer.json` file:

```
"repositories": [
    {
        "type": "path",
        "url": "../yii2-webhooks"
    }
]

```

Install it to the project using composer:

`composer require --prefer-dist doohlabs/yii2-webhooks "*"`

You can edit the files from within you project, directly in your `vendor` folder, for it is much more convenient that way.

Credits
-------

[](#credits)

This extension is maintained by [Doohlabs](https://www.doohlabs.com/).

The original extension was created and is maintained by [Bornfight](https://www.bornfight.com).

License
-------

[](#license)

MIT

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 50% 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 ~230 days

Recently: every ~283 days

Total

6

Last Release

1575d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/099eb363f5e944591fdf664834748ae4850304f9a5e2a07450545b1708dbe7eb?d=identicon)[doohlabs](/maintainers/doohlabs)

---

Top Contributors

[![tony-doohlabs](https://avatars.githubusercontent.com/u/93319970?v=4)](https://github.com/tony-doohlabs "tony-doohlabs (11 commits)")[![napravicukod](https://avatars.githubusercontent.com/u/2182708?v=4)](https://github.com/napravicukod "napravicukod (10 commits)")[![sizeg](https://avatars.githubusercontent.com/u/4047591?v=4)](https://github.com/sizeg "sizeg (1 commits)")

---

Tags

extensionwebhookyii2yii2extensionwebhook

###  Code Quality

TestsCodeception

### Embed Badge

![Health badge](/badges/doohlabs-yii2-webhooks/health.svg)

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

###  Alternatives

[dotzero/yii2-amocrm

Расширение для Yii Framework 2 реализующее клиент для работы с API amoCRM

1639.7k](/packages/dotzero-yii2-amocrm)[conquer/services

Yii2 soap wsdl web services

1632.5k](/packages/conquer-services)[apexwire/yii2-restclient

Tools to use API as ActiveRecord for Yii2

143.5k](/packages/apexwire-yii2-restclient)

PHPackages © 2026

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