Search by

triangle / events

localzet

Triangle Events Component

Package info

github.com/Triangle-org/Events

pkg:composer/triangle/events

Fund package maintenance!

localzet

Statistics

Installs: 141

Dependents: 2

Suggesters: 0

Stars: 4

Open Issues: 0

v2.0.1 2026-11-21 01:50 UTC

README

Скачивания Коммиты Версия Версия PHP Лицензия

Triangle Events

Triangle Events registers application event listeners during Engine startup and provides an in-process dispatcher with exact-name and prefix listeners.

Requirements

  • PHP 8.1 or later
  • Triangle Engine 9.x

Install the package with Composer:

composer require triangle/events:^2.0

Register and dispatch events

use support\Events;

Events::on('invoice.created', static function (array $invoice, string $event): void {
    // Handle the created invoice.
});

Events::emit('invoice.created', ['id' => 42]);

Use a trailing * to register a prefix listener, for example invoice.*. Listeners receive the event payload followed by the event name. Dispatch is process-local; it does not provide durable queueing or cross-worker delivery.

Listeners can also be declared in config/event.php:

return [
    'invoice.created' => [
        [App\Listeners\InvoiceCreated::class, 'handle'],
    ],
];

The Engine bootstrap loads application and plugin event configuration at startup. Engine 8 is not supported: this component uses the plugin configuration hooks introduced in Engine 9.

Русская версия: README.ru.md.