PHPackages                             warrickbayman/incus - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. warrickbayman/incus

AbandonedArchivedLibrary[Mail &amp; Notifications](/categories/mail)

warrickbayman/incus
===================

A Mandrill webhooks processor

0.1.4(10y ago)01.8kMITPHPPHP &gt;=5.4.0

Since Dec 4Pushed 10y ago1 watchersCompare

[ Source](https://github.com/warrickbayman/Incus)[ Packagist](https://packagist.org/packages/warrickbayman/incus)[ RSS](/packages/warrickbayman-incus/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (3)Dependencies (2)Versions (7)Used By (0)

Incus
=====

[](#incus)

[![Build Status](https://camo.githubusercontent.com/dc23a7f9fb4e96e1bcec23df812780bab897bbfa982f7f148e549d0e426e12ce/68747470733a2f2f7472617669732d63692e6f72672f7761727269636b6261796d616e2f496e6375732e737667)](https://travis-ci.org/warrickbayman/Incus)[![Stable](https://camo.githubusercontent.com/a8c648a7f14247a5fcb42c56a54d517eb2dfd00b81160459f9b16255b55ac020/68747470733a2f2f706f7365722e707567782e6f72672f7761727269636b6261796d616e2f696e6375732f762f737461626c652e737667)](https://packagist.org/packages/warrickbayman/incus)[![Latest Unstable Version](https://camo.githubusercontent.com/018628d24695d2d10acdd5c6de79b2825c8f2e9d5fdd405f7bdd10112235c0af/68747470733a2f2f706f7365722e707567782e6f72672f7761727269636b6261796d616e2f696e6375732f762f756e737461626c65)](https://packagist.org/packages/warrickbayman/incus)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/dd9ab11e044982325fce1debc3443f3a80ab2d99cf2d0f633ec3630606b60665/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7761727269636b6261796d616e2f496e6375732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/warrickbayman/Incus/?branch=master)[![License](https://camo.githubusercontent.com/78a8de1bdb6f80f08dc0723dd19779d691e9cebdf309dc73db4cbe0723f58a3a/68747470733a2f2f706f7365722e707567782e6f72672f7761727269636b6261796d616e2f696e6375732f6c6963656e7365)](https://packagist.org/packages/warrickbayman/incus)

[![SensioLabsInsight](https://camo.githubusercontent.com/36633e43cf08322e94b2423752dde03c93cd15fec3a97f2a2742a5cbac22f607/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f30326236656535342d633738362d346465342d623338372d3338646566653633663134322f736d616c6c2e706e67)](https://insight.sensiolabs.com/projects/02b6ee54-c786-4de4-b387-38defe63f142)

Incus is an easy to use Mandrill webhooks processor. The Webhooks data sent by Mandrill can sometimes be a bit confusing, so Incus attempts to simplifies the matter.

MailChump?
----------

[](#mailchump)

So MailChimp pulled a fast one on us. I see what you did there. Sneaky. Anyway, since the continued development of this package would require a paid MailChimp account that I simply don't need, this is likely the end.

It really sucks. Mandrill is a great service, but MailChimp kinda ruined it for a lot of us.

So this is it. I'll leave it here for anyone who can still use it, but there won't be any bug fixes from my side.

Status
------

[](#status)

Incus is under development and although it works, and you can use it right away, it's far from perfect. Mandrill is a service I used constantly, so Incus will grow as I need to add features to it.

If you find bugs, please use the issue tracker here: [Issue Tracker](https://github.com/warrickbayman/incus/issues).

Please also be aware that the documentation is fairly incomplete as it is growing with the project. As I complete features, so I will write better documentation.

Sometimes my tests get away from me and I find myself writing tests for code I've written. But at least the tests exist, right. Anyway, it's not quite 100% covered, but I'm getting there.

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

[](#installation)

Incus can be installed via Composer. Add the following to the `require` section of your `composer.json` file:

```
{
	"require": {
		"warrickbayman/Incus": "~0.1"
	}
}
```

And run `composer update`.

If you feel like living on the edge, replace "~0.1" with "dev-master".

The Basics
----------

[](#the-basics)

Create a working POST route and write a controller to look something like:

```
use Incus\Incus;
use Incus\Listener;

class MyMandrillApp extends Controller
{
	public funtion webhooks()
	{
		Incus::listen(function(Listener $listener)
		{
			$listener->send(function($event)
			{
				...
				...
			})

			->open(function($event)
			{
				...
				...
			});

			->softBounce(function($event)
			{
				...
				...
			});
		});
	}
}
```

The `listen()` method will respond to any POST request containing a `mandrill_events` property. Pass a closure with a parameter of type `Listener` to the `listen()` method. The `Listener` class provides a number of methods as event handlers.

The Listen method also returns an array of the recieved events so you can process them yourself if don't want to use the Incus event handlers.

```
class MyMandrillApp extends Controller
{
	public function webhooks()
	{
		$events = Incus::listen();

		foreach ($events as $event) {
			echo "Event occured: " . $event->at()->format('d F Y');
		}
	}
}
```

Event Handlers
--------------

[](#event-handlers)

The following methods are provided by the `Listener` class. For each event found in the `mandrill_events` object, the appropriate event handler is fired once.

```
$listener
	->send()
	->deferral()
	->open()
	->click()
	->softBounce()
	->hardBounce()
	->spam()
	->unsub()
	->reject()
```

Each event handler recieves a function as a parameter, which in turn takes an instance of the `Event` class as a parameter. The `Event` class provides a number of methods for working with the actual Mandrill Event. The following methods are provided by the `Event` object.

### -&gt;at()

[](#-at)

The `at` property is the time when the event was fired as a `Carbon` instance, so you have all the Carbon functionality on it.

```
$listener->send(function($event)
{
	echo $event->at()->format('d F Y');
});
```

### -&gt;indexed()

[](#-indexed)

Whether or not the message has been indexed. The property will always return false if the `->raw->msg` property is empty, or doesn't exist. Mandrill messages may not be indexed if an event occures soon after the message is delivered.

```
	if ($event->indexed()) {
		echo 'Message has been indexed'
	}
```

### -&gt;message()

[](#-message)

Grab the message from the event. This method returns an instance of the `Message` class.

```
$listener->softBounce(function($event))
{
	$message = $event->message();
	Log::info('Message was sent to ' . $message->to());
}
```

### -&gt;raw()

[](#-raw)

The `raw` property will return the Mandrill event as a json object as it was received from the webhook. Nothing return by this property is altered or processed.

```
$listener->click(function($event)
{
	if ($event->raw()->user_agent_parsed->mobile) {
		echo 'User agent is mobile!';
	}
});
```

### -&gt;type()

[](#-type)

Returns the type of event that occured. This is only really useful if you collect an array of events from the `listen()` method. The `Listener` class also provides a set of constants that you can use for comparrison.

```
$events = Incus::listen();
foreach ($events as $event) {
	if ($event->type() === Listener::EVENT_CLICK) {
		Log::info('Click event!');
	}
}
```

Message
-------

[](#message)

The `Message` object provides a whole bunch of information about the actual message. The basic ones include:

```
->id()          Returns the unique ID of the message.
->at()          Returns a Carbon instance for when the message was sent.
->to()          Returns the email address the message was sent to.
->from()        Returns the email address the message was sent from.
->subject()     Returns the subject of the message.
->state()       Returns the state of the message as a string.
->subAccount()  Returns the sub account used for the message.
->template()    Returns the name of the template used for the message.
->tags()        Returns an array of tags applied to the message.

```

For bounced messages, there is also a `diag()` method which returns a diagnosis message, and a `bounceDescription()` method which returns a short reason for the message bouncing.

There is also a `metadata()` method which returns an instance of the `Metadata` class. This class provides three methods: `all()`, `has()` and `get()`.

```
$listener->click(function($event)
{
    if ($event->message()->metadata()->has('user_id')) {
        $userId = $event->message->metadata()->get('user_id');
    }
});
```

If Mandrill has not index the message (which is possible if the message is very new, or older than 30 days), then the `message()` method will return null. To avoid any problems, it's advisable to check if the message has been indexed using the `indexed()` method detailed earlier.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

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

Recently: every ~53 days

Total

6

Last Release

3961d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/89ea2dc12cd0a934de60705f8cfe47397095d842121b7d5f545dc9d1cee554ec?d=identicon)[warrickbayman](/maintainers/warrickbayman)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/warrickbayman-incus/health.svg)

```
[![Health](https://phpackages.com/badges/warrickbayman-incus/health.svg)](https://phpackages.com/packages/warrickbayman-incus)
```

###  Alternatives

[webklex/php-imap

PHP IMAP client

4365.5M14](/packages/webklex-php-imap)[laravel-notification-channels/apn

Apple APN Push Notification Channel

2021.9M4](/packages/laravel-notification-channels-apn)[directorytree/imapengine

A fully-featured IMAP library -- without the PHP extension

531175.4k4](/packages/directorytree-imapengine)[ferdous/laravel-otp-validate

Laravel package for OTP validation with built-in features like retry and resend mechanism. Built in max retry and max resend blocking. OTP/Security Code can be send over SMS or Email of your choice with user-defined template.

7124.4k](/packages/ferdous-laravel-otp-validate)[meness/verifi

A Laravel package to handle email verification.

5516.9k](/packages/meness-verifi)[taiwan-sms/every8d

every8d sms api client

1817.8k](/packages/taiwan-sms-every8d)

PHPackages © 2026

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