PHPackages                             degordian/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. degordian/yii2-webhooks

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

degordian/yii2-webhooks
=======================

Yii2 extension for webhooks

1.0.1(7y ago)107.3k↓32.1%5[4 issues](https://github.com/degordian/yii2-webhooks/issues)MITPHP

Since Nov 30Pushed 5y ago17 watchersCompare

[ Source](https://github.com/degordian/yii2-webhooks)[ Packagist](https://packagist.org/packages/degordian/yii2-webhooks)[ RSS](/packages/degordian-yii2-webhooks/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (3)Versions (3)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 degordian/yii2-webhooks "dev-master"
```

Setup
-----

[](#setup)

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

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

The extension needs to be bootstrapped:

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

Add the module to the config:

```
'modules' => [
    // ...
    'webhooks' => [
        'class' => 'degordian\webhooks\Module',
    ],
],
```

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`.

### 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' => 'degordian\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 degordian/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 created and maintained by [Bornfight](https://www.bornfight.com).

[![](https://camo.githubusercontent.com/fa883f0569c234c4faf4e33914e939e45e05c3f48c902b0df8444c82e80bfddb/68747470733a2f2f7777772e626f726e66696768742e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031382f30392f74775f73686172652e706e67)](https://camo.githubusercontent.com/fa883f0569c234c4faf4e33914e939e45e05c3f48c902b0df8444c82e80bfddb/68747470733a2f2f7777772e626f726e66696768742e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031382f30392f74775f73686172652e706e67)

License
-------

[](#license)

TBD

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance12

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 90.9% 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 ~18 days

Total

2

Last Release

2753d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/82d5eb84ce1c2561ee26fba2f6954d6f8686cc5fec19809222e8b35d9ae85774?d=identicon)[Degordian](/maintainers/Degordian)

---

Top Contributors

[![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

bornfightyii2extensionwebhook

###  Code Quality

TestsCodeception

### Embed Badge

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

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

###  Alternatives

[imanilchaudhari/yii2-currency-converter

This extension will help to find out current currency conversion rate.

2111.7k](/packages/imanilchaudhari-yii2-currency-converter)[abei2017/yii2-wx

一个专注于yii2的微信sdk

1472.8k](/packages/abei2017-yii2-wx)[dmstr/yii2-cookie-consent

Yii2 Cookie Consent Widget

1455.6k](/packages/dmstr-yii2-cookie-consent)

PHPackages © 2026

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