PHP code example of lecorp / lenats
1. Go to this page and download the library: Download lecorp/lenats 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/ */
lecorp / lenats example snippets
$publisher = $container->get(\LeNats\Subscription\Publisher::class);
$event = new \LeNats\Events\CloudEvent();
$event->setType('some.event.type.created'); // This event wil be published to some.event.type queue
// $event->setId('unique-id'); Id will gets from data['id'] field, if it exists
$data = [
'id' => 'unique-id',
'value' => 'Some event value'
];
$event->setData($data);
$publisher->publish($event);