1. Go to this page and download the library: Download jtl/nachricht 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/ */
jtl / nachricht example snippets
use JTL\Nachricht\Contract\Message\Message;
class DummyMessage implements Message
{
private string $data;
public function __construct(string $data)
{
$this->data = $data;
}
public function getData(): string
{
return $this->data;
}
}
use JTL\Nachricht\Contract\Listener\Listener;
class DummyListener implements Listener
{
public function listen(DummyMessage $event): void
{
echo 'Dummy Listener called: ' . $event->getData() . "\n";
}
}
$emitter = $container->get(DirectEmitter::class);
$event = new FooMessage('Test');
$emitter->emit($event);
# php examples/DirectEmit/DirectEmit.php
FooListener called: Test
$event = new DelayedDummyAmqpMessage(data: 'Test', delay: 3);
$emitter->emit($event);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.