PHPackages                             initphp/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. initphp/events

ActiveLibrary

initphp/events
==============

Events (Hook) Library

1.0.2(3y ago)612021MITPHPPHP &gt;=5.6

Since Mar 17Pushed 3y ago1 watchersCompare

[ Source](https://github.com/InitPHP/Events)[ Packagist](https://packagist.org/packages/initphp/events)[ RSS](/packages/initphp-events/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (4)Used By (1)

Events
======

[](#events)

It allows you to run functions from outside in different places within your software. It allows you to set up a similar structure known as a hook in the Wordpress ecosystem.

[![Latest Stable Version](https://camo.githubusercontent.com/e53794200d57d3503b626e8883e6869837107f2bb270f9536a499eb3a2c009c6/687474703a2f2f706f7365722e707567782e6f72672f696e69747068702f6576656e74732f76)](https://packagist.org/packages/initphp/events) [![Total Downloads](https://camo.githubusercontent.com/35551ea8332f88e505101c188f3a62420e4c65a86fcb83e20ac7f611a6634c05/687474703a2f2f706f7365722e707567782e6f72672f696e69747068702f6576656e74732f646f776e6c6f616473)](https://packagist.org/packages/initphp/events) [![Latest Unstable Version](https://camo.githubusercontent.com/9d205b56e0af06d9c6f7f864cb65f4ea1ab965b82fde994d097de91738f63de8/687474703a2f2f706f7365722e707567782e6f72672f696e69747068702f6576656e74732f762f756e737461626c65)](https://packagist.org/packages/initphp/events) [![License](https://camo.githubusercontent.com/607bc76f40bcd4fb0b90c3aef8954eb30d481a2b720088fc8a732e18518760b7/687474703a2f2f706f7365722e707567782e6f72672f696e69747068702f6576656e74732f6c6963656e7365)](https://packagist.org/packages/initphp/events) [![PHP Version Require](https://camo.githubusercontent.com/1cc7c8995b984b8fa90f384fd5defe009970d503cea09f2bdb2585db54a01d31/687474703a2f2f706f7365722e707567782e6f72672f696e69747068702f6576656e74732f726571756972652f706870)](https://packagist.org/packages/initphp/events)

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

[](#requirements)

- PHP 5.6 or higher
- [InitPHP EventEmitter Library](https://github.com/InitPHP/EventEmitter)

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

[](#installation)

```
composer require initphp/events

```

Usage
-----

[](#usage)

Call the `trigger()` method where the events will be added. Send event with `on()` method.

```
require_once "vendor/autoload.php";
use \InitPHP\Events\Events;

Events::on('helloTrigger', function(){
    echo 'Hello World' . PHP_EOL;
}, 100);

Events::on('helloTrigger', function(){
    echo 'Hi, World' . PHP_EOL;
}, 99);

Events::trigger('helloTrigger');
```

**Output :**

```
Hi World
Hello World

```

### Use of Arguments

[](#use-of-arguments)

```
require_once "vendor/autoload.php";
use \InitPHP\Events\Events;

Events::on('helloTrigger', function($name, $myName){
    echo 'Hello ' . $name . '. I am ' . $myName . '.' . PHP_EOL;
}, 100);

Events::on('helloTrigger', function($name, $myName){
    echo 'Hi ' . $name . '. I am ' . $myName . '.' . PHP_EOL;
}, 99);

Events::trigger('helloTrigger', 'World', 'John');
```

**Output :**

```
Hi World. I am John.
Hello World. I am John.

```

Credits
-------

[](#credits)

- [Muhammet ŞAFAK](https://www.muhammetsafak.com.tr) &lt;&gt;

License
-------

[](#license)

Copyright © 2022 [MIT License](./LICENSE)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity46

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

Total

3

Last Release

1409d ago

PHP version history (2 changes)1.0PHP &gt;=7.4

1.0.2PHP &gt;=5.6

### Community

Maintainers

![](https://www.gravatar.com/avatar/4b6b34f3ac8938d8ee52ba3bd260680855dc5715c7b2929d9380de30d15a67dd?d=identicon)[muhammetsafak](/maintainers/muhammetsafak)

---

Top Contributors

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

---

Tags

phpphp-eventphp-hookphp-hooks

### Embed Badge

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

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

PHPackages © 2026

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