-
Notifications
You must be signed in to change notification settings - Fork 2
Installation
initphp/events is distributed exclusively through Composer.
| Requirement | Notes |
|---|---|
PHP >= 5.6
|
The library ships pure PHP and uses only microtime, call_user_func_array, array_* and a handful of other built-ins available since 5.x. |
| Composer | Any reasonably recent version. |
No PHP extensions, no third-party dependencies, no autoloading magic beyond PSR-4.
composer require initphp/eventsThat single command:
- Adds the package to your
composer.json. - Registers the PSR-4 namespace
InitPHP\Events\againstvendor/initphp/events/src/. - Autoloads
src/aliases.phpso legacyInitPHP\EventEmitter\*class names continue to resolve. See the Migration Guide for the full story.
Composer also honours the replace declaration in this package — it will
not install the deprecated initphp/event-emitter alongside it, even if
something in your dependency tree still asks for it.
A one-line smoke test:
<?php
require __DIR__ . '/vendor/autoload.php';
\InitPHP\Events\Events::on('boot', function () { echo "ok\n"; });
\InitPHP\Events\Events::trigger('boot');$ php smoke.php
ok
If you see ok, the autoloader resolved the classes and the package is
ready to use. Continue to Quick Start.
The library follows SemVer. Major versions can introduce breaking changes (see the Migration Guide for the 1.x → 2.x notes). Minor and patch releases keep the public surface backwards-compatible.
composer update initphp/events{
"require": {
"initphp/events": "^2.0"
}
}If you are still on PHP 5.6/7.x and want to lock to a 1.x line, use:
{
"require": {
"initphp/events": "^1.0"
}
}The 1.x line lacks the bundled low-level EventEmitter; use
2.x whenever your PHP version allows.
composer remove initphp/eventsinitphp/events · MIT License · part of the InitPHP family
Source · Issues · Discussions · Packagist · Contributing · Security Policy
Getting Started
Core APIs
Practical
Reference