1. Go to this page and download the library: Download earc/observer 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/ */
earc / observer example snippets
$ composer
use eArc\DI\DI;
DI::init();
use eArc\Observer\Interfaces\EventInterface;
use eArc\Observer\Interfaces\ListenerInterface;
class SomeEvent implements EventInterface
{
public static function getApplicableListener(): array
{
return [ListenerInterface::class];
}
}
use eArc\Observer\Observer;
$observer = di_get(Observer::class);
$observer->registerListener(SomeListener::class);
use eArc\Observer\Observer;
di_tag(Observer::class, SomeListener::class);
use eArc\Observer\Observer;
$observer = di_get(Observer::class);
$observer->registerListener(SomeListener::class, 0.2);
use eArc\Observer\Observer;
di_tag(Observer::class, SomeListener::class, -12.7);