PHP code example of labrador-kennel / async-event-autowire

1. Go to this page and download the library: Download labrador-kennel/async-event-autowire 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/ */

    

labrador-kennel / async-event-autowire example snippets


 declare(strict_types=1);

use Cspray\AnnotatedContainer\Bootstrap\Bootstrap;
// Replace this with the ContainerFactory implementation of your choice
use Cspray\AnnotatedContainer\ContainerFactory\PhpDiContainerFactory;
use Cspray\AnnotatedContainer\Event\Emitter;
use Labrador\AsyncEvent\Autowire\RegisterAutowiredListener;


 declare(strict_types=1);

use Amp\Future
use Labrador\AsyncEvent\Event;
use Labrador\AsyncEvent\Listener;
use Labrador\AsyncEvent\Autowire\AutowiredListener;
use Labrador\CompositeFuture\CompositeFuture;

#[AutowiredListener('my-event-name')]
final class MyListener implements Listener {

    public function handle(Event $event) : Future|CompositeFuture|null {
        // do the thing for your listener
        return null;
    }

}