kaycn / php-nats
Nats client
dev-master
2023-05-15 03:08 UTC
Requires
- php: ^8.0
Requires (Dev)
- phpunit/phpunit: ^9.6
This package is not auto-updated.
Last update: 2024-11-26 06:02:04 UTC
README
nats client
Publish message
<?php $natsOption = new ConnectOption(); $natsOption->setName('php-nats'); $nats = new NatsTransport("192.168.31.78:4222",$natsOption,5); $nats->publish('test',111)
Subscribe message
$nats = new NatsTransport("192.168.31.78:4222",$natsOption,5); $res = $nats->subscribe('test',2555); while ($msg = $nats->receive()){ if(str_starts_with($msg, 'MSG test')){ echo trim($nats->receive()); } }