Travis
Coverage
A PHP client for the NATS messaging system.
Note: phpnats is under heavy development.
Let's start by downloading composer into our project dir:
curl -O http://getcomposer.org/composer.phar
chmod +x composer.phar
Now let's tell composer about our project's dependancies, in this case, PHPNats. The way we do this is by creating a composer.json file, and placing it in the root folder of our project, right next to composer.phar
{
"require": {
"repejota/nats": "master"
}
}
Let's let Composer work its magic:
php composer.phar install
Composer will download all the dependencies defined in composer.json, and prepare all the files needed to autoload them.
$client = new \Nats\Connection();
$client->connect();
# Simple Publisher
$client->publish("foo", "foo bar");
# Simple Subscriber
$callback = function($payload)
{
printf("Data: %s\r\n", $payload);
};
$client->subscribe("foo", $callback);
# Wait for 1 message
$client->wait(1);
Tests are in the tests
folder.
To run them, you need PHPUnit
and execute make test
.
We are using PHP Code Sniffer to ensure our code follow an high quality standard.
To perform an analysis of the code execute make cs
.
Raül Pérez
Adrià Cidre
José Gil
Gorka López de Torre
MIT, see LICENSE