PHP code example of italix / events

1. Go to this page and download the library: Download italix/events library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

italix / events example snippets


// conf.php — the whole registry, in one place
Events::class => static fn(): Events => (new Events())
    ->on('record.status_changed', [NotifyParties::class, 'handle'])
    ->on('record.status_changed', [WriteAuditRow::class, 'handle'], 10),

$this->events->dispatch('record.status_changed', new RecordStatusChanged($id, 'CONFIRMED'));

$failures = $events->dispatch('record.saved', $event);

foreach ($failures as $failure) {
    // ['event_c' => …, 'listener' => 'closure conf.php:212', 'error' => 'RuntimeException: …']
}

$events = events()->log_failures_to($container->get(LoggerInterface::class));
bash
php src/Libs/Italix/Events/tests/EventsTest.php