PHPackages                             lorenzo/cakephp-gridhook - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. lorenzo/cakephp-gridhook

ActiveCakephp-plugin[HTTP &amp; Networking](/categories/http)

lorenzo/cakephp-gridhook
========================

CakePHP Webhook event handler for SendGrid

33231PHP

Since Apr 9Pushed 12y ago1 watchersCompare

[ Source](https://github.com/lorenzo/cakephp-gridhook)[ Packagist](https://packagist.org/packages/lorenzo/cakephp-gridhook)[ RSS](/packages/lorenzo-cakephp-gridhook/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Webhook handler for SendGrid events#
====================================

[](#webhook-handler-for-sendgrid-events)

This plugin provides a dispatcher filter that will listen to any request send from SendGrid as a webhook and fire any configured callback with the decoded data as it was received.

This is useful for storing or calculating your own statistics about emails you send, to unsubscribe users when emails bounce or when marked as spam.

Requirements
------------

[](#requirements)

- CakePHP 2.x
- PHP 5.3+
- Composer

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

[](#installation)

The only installation method supported by this plugin is by using composer. Just add this to your composer.json configuration:

```
{
  "require" : {
	"lorenzo/cakephp-gridhook": "master"
  }
}

```

### Enable plugin

[](#enable-plugin)

You need to enable the plugin your `app/Config/bootstrap.php` file:

```
CakePlugin::load('GridHook');

```

Additionally, in the same file, add this to your dispatcher filters array:

```
Configure::write('Dispatcher.filters', array(
	// ... Other filters ...
	'GridHook' => array(
		'callable' => 'GridHook.SendgridWebhookDispatcher',
		'handler' => 'MyHandlerClass::aMethod' // Configure this value at will
	)
));

```

The `handler` key is any valid callable object or closure that will be called each time an event is received from SendGrid. The `handler` key is mandatory for this plugin to work correctly. Another example:

```
Configure::write('Dispatcher.filters', array(
	// ... Other filters ...
	'GridHook' => array(
		'callable' => 'GridHook.SendgridWebhookDispatcher',
		'handler' => function($sendGridEvent) {
			// Do some stuff
		}
	)
));

```

### Configuring listener url

[](#configuring-listener-url)

By default this plugin will listen on the `/webhook/sendgrid` url, if for any reason you want to change it, set the `endpoint` key to another path

```
Configure::write('Dispatcher.filters', array(
	// ... Other filters ...
	'GridHook' => array(
		'callable' => 'GridHook.SendgridWebhookDispatcher',
		'handler' => 'MyHandlerClass::aMethod' // Configure this value at will,
		'endpoint' => '/sendgrid-hook'
	)
));

```

Handling an event sent from SendGrid
------------------------------------

[](#handling-an-event-sent-from-sendgrid)

The callback configured in the `handler` key will be called for each event generated from sendgrid that was received via the webhook. The first argument of this function will be an object of type `SendGridEvent` that will contain call the properties sent for the event. This is an example:

```
App::uses('SendGridEvent', 'GridHook.Model');

class Newsletter extends AppModel {

	public static function handleEvent(SendgidEvent $event) {
		if ($event->isSpamReport()) {
			ClassRegistry::init('User')->usubscribe($event->email);
		}
	}
}

```

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 52.6% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/5b4694a64f9dab01ec0e776946b15c84113dee8a51344f1c394f40bd7a453312?d=identicon)[lorenzo](/maintainers/lorenzo)

---

Top Contributors

[![lorenzo](https://avatars.githubusercontent.com/u/37621?v=4)](https://github.com/lorenzo "lorenzo (10 commits)")[![jippi](https://avatars.githubusercontent.com/u/22841?v=4)](https://github.com/jippi "jippi (9 commits)")

### Embed Badge

![Health badge](/badges/lorenzo-cakephp-gridhook/health.svg)

```
[![Health](https://phpackages.com/badges/lorenzo-cakephp-gridhook/health.svg)](https://phpackages.com/packages/lorenzo-cakephp-gridhook)
```

###  Alternatives

[php-http/cache-plugin

PSR-6 Cache plugin for HTTPlug

25025.5M80](/packages/php-http-cache-plugin)[illuminate/http

The Illuminate Http package.

11937.2M6.6k](/packages/illuminate-http)[rdkafka/rdkafka

A PHP extension for Kafka

2.2k20.0k1](/packages/rdkafka-rdkafka)[httpsoft/http-message

Strict and fast implementation of PSR-7 and PSR-17

87930.4k113](/packages/httpsoft-http-message)[mezzio/mezzio-router

Router subcomponent for Mezzio

265.3M84](/packages/mezzio-mezzio-router)[serpapi/google-search-results-php

Get Google, Bing, Baidu, Ebay, Yahoo, Yandex, Home depot, Naver, Apple, Duckduckgo, Youtube search results via SerpApi.com

69122.6k](/packages/serpapi-google-search-results-php)

PHPackages © 2026

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