PHPackages                             s1mpletru1h/events - 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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. s1mpletru1h/events

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

s1mpletru1h/events
==================

Events - the foundation of everything.

0.0.2(6y ago)16MITPHPPHP &gt;=7.0.0CI failing

Since Jul 22Pushed 6y agoCompare

[ Source](https://github.com/s1mpletru1h/php-events)[ Packagist](https://packagist.org/packages/s1mpletru1h/events)[ RSS](/packages/s1mpletru1h-events/feed)WikiDiscussions master Synced yesterday

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

[![](https://raw.githubusercontent.com/s1mpletru1h/php-events/master/logo.svg?sanitize=true)](https://raw.githubusercontent.com/s1mpletru1h/php-events/master/logo.svg?sanitize=true)

EVENTS | The foundation of everything.

[![Build Status](https://camo.githubusercontent.com/6d51547415ea652d4c6cfc0d15c1af71f5ade9e49078b15a1845c05a4735a324/68747470733a2f2f7472617669732d63692e6f72672f73316d706c6574727531682f7068702d6576656e74732e737667)](https://travis-ci.org/s1mpletru1h/php-events)[![Total Downloads](https://camo.githubusercontent.com/71c13e5e5ebbec94d618b5a6869e22f70027d04064681a72942982eee04753cb/68747470733a2f2f706f7365722e707567782e6f72672f73316d706c6574727531682f6576656e74732f642f746f74616c2e737667)](https://packagist.org/packages/s1mpletru1h/events)[![Latest Stable Version](https://camo.githubusercontent.com/704c1378a84f6863962e00fd0bd4d9b684ead30ff2c69e2dc2f9fd9a77bb0be2/68747470733a2f2f706f7365722e707567782e6f72672f73316d706c6574727531682f6576656e74732f762f737461626c652e737667)](https://packagist.org/packages/s1mpletru1h/events)[![License](https://camo.githubusercontent.com/f48c65203117ccb376ac82e148aa58ca2d00f107f3fd2cff5a4812d15e2fa980/68747470733a2f2f706f7365722e707567782e6f72672f73316d706c6574727531682f6576656e74732f6c6963656e73652e737667)](https://packagist.org/packages/s1mpletru1h/events)

About Events
------------

[](#about-events)

Events allow you to see everything that is happening in your application.

Events do this by allowing you to create synchronous, event-driven functional callback-response graphs in any application, by calling just two simple methods:

`$events->pub($event_name)` and `$events->sub($event_name, $callback)`

Colorful logging allows you to see what is going on in your application through your choice of standard out, text file logs, and in the near future, in-memory and sql/no-sql data stores.

### Simple:

[](#simple)

An `EVENT` is just an all-caps text string, with an optional colon separating the `:LEVEL` which can be any of the following strings, `['VERBOSE', 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']`, and an arbitrary array `['of' => $data]`.

Events are published through the `$events->pub('EVENT:LEVEL', ['arbitrary' => $data]);` function, and subscribed to with `$events->sub('EVENT', function($event, $data) {...});`

### Testable:

[](#testable)

You can see whether or not an event happened simply by calling `$events->didOccur(['SOME', 'EVENTS'], $within_the_last_n_events);` This method will return `true` if all of your events really did happen `$within_the_last_n_events`, or `false` otherwise.

### Easy:

[](#easy)

Every event can have unlimited callbacks bound to fire every time it is trigged. The only requirement is that the callback must take two arguments: the event name (a required string) and the event data (an optional array). Event subscriber callback return values are captured and pushed onto an array, and returned from the pub function in an array that preserves the order in which they were returned.

### Fun:

[](#fun)

Colorful logs make running your application fun to watch in standard out, log files per instance, or combined into a single master log file, or both (database event logging coming soon!).

Usage
-----

[](#usage)

```
// create an instance of events
$this->events = new Events('main', Events::DEBUG);

// subscribe to an event and trigger a callback that takes the $event and an array of optional $data
$this->events->sub('EVERYTHING_BEGINS', function(string $event, array $data = []) {
   return "$event really did happen";
});

// trigger the event, and all of it's callbacks fired in their subscribe order by publishing the event
$now = $this->events->pub('EVERYTHING_BEGINS', ['with' => 'a bang']);

// see the value of everything by publishing an event to a log level of your choice with 'EVENT:LEVEL'
$this->events->pub('RETURNED_VALUES:DEBUG', $now);

// ensure that an event really did happen within the last $n events
$did_occur = $this->events->didOccur(['RETURNED_VALUES'], 2);

```

Testing
-------

[](#testing)

```
composer install
phpunit

```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~36 days

Total

2

Last Release

2450d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c497ca9003a3f392275ebe1b2ef2699b3c3b63dc9f2bdd3551960fb42ef1a634?d=identicon)[s1mpletru1h](/maintainers/s1mpletru1h)

---

Top Contributors

[![s1mpletru1h](https://avatars.githubusercontent.com/u/31410315?v=4)](https://github.com/s1mpletru1h "s1mpletru1h (2 commits)")

---

Tags

loggingeventsbindingpubsub

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/s1mpletru1h-events/health.svg)

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

###  Alternatives

[monolog/monolog

Sends your logs to files, sockets, inboxes, databases and various web services

21.4k964.9M7.0k](/packages/monolog-monolog)[symfony/monolog-bundle

Symfony MonologBundle

2.9k249.1M1.6k](/packages/symfony-monolog-bundle)[itsgoingd/clockwork

php dev tools in your browser

5.9k27.6M94](/packages/itsgoingd-clockwork)[sentry/sentry

PHP SDK for Sentry (http://sentry.io)

1.9k227.1M273](/packages/sentry-sentry)[sentry/sentry-laravel

Laravel SDK for Sentry (https://sentry.io)

1.3k114.3M154](/packages/sentry-sentry-laravel)[sentry/sentry-symfony

Symfony integration for Sentry (http://getsentry.com)

73761.4M66](/packages/sentry-sentry-symfony)

PHPackages © 2026

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