PHP code example of mammatus / life-cycle-events
1. Go to this page and download the library: Download mammatus/life-cycle-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/ */
mammatus / life-cycle-events example snippets
declare(strict_types=1);
namespace WyriHaximus\Apps\WyriHaximusNet\GitHub\Ingest;
use Mammatus\LifeCycleEvents\Initialize;
use Mammatus\LifeCycleEvents\Shutdown;
use Psr\Log\LoggerInterface;
use WyriHaximus\Broadcast\Contracts\Listener;
final class Consumer implements Listener
{
private LoggerInterface $logger;
public function __construct(ConsumerContract $consumer, Producer $producer, LoggerInterface $logger)
{
$this->logger = $logger;
}
public function start(Initialize $event): void
{
$this->logger->debug('Starting to consume ingested GitHub WebHook events');
}
public function stop(Shutdown $event): void
{
$this->logger->debug('Stopping to consume ingested GitHub WebHook events');
}
}