1. Go to this page and download the library: Download nacosvel/mitt 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/ */
nacosvel / mitt example snippets
$mitt = new \Nacosvel\Mitt\Emitter();
$mitt->on('user.registered', function ($user) {
echo "User registered: {$user->name}";
});
$user = new User(['name' => 'John Doe']);
$mitt->emit('user.registered', $user);
$mitt->off('user.registered');
$mitt->once('user.updated', function ($user) {
echo "User updated: {$user->name}";
});
$mitt = new \Nacosvel\Mitt\Emitter();
$mitt->on('order.created', function ($order) {
echo "Order created: {$order->id}";
});
$mitt->emit('order.created', ['id' => 123]);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.