Monolog handler for sending logs to NATS (http://nats.io). Useful for async recording those logs on another machine.
composer require repejota/monolog-nats
This will install this package itself Monolog and PHPNAts, if they are not yet installed.
<?php
require_once __DIR__.'/../vendor/autoload.php';
use Nats\Connection;
use Monolog\Logger;
use Monolog\Handler\NatsHandler;
$nats = new Connection();
$nats->connect();
$logger = new Logger("monolog-nats-logger");
$natsHandler = new NatsHandler($nats);
$logger->pushHandler($natsHandler);
$logger->info("Info log");