Skip to content
This repository was archived by the owner on Oct 30, 2024. It is now read-only.

Commit b4e9014

Browse files
committed
Merge branch 'develop' of github.com:repejota/phpnats into develop
2 parents 9ccf354 + dbc8659 commit b4e9014

5 files changed

Lines changed: 26 additions & 23 deletions

File tree

examples/authconnect.php

Lines changed: 0 additions & 6 deletions
This file was deleted.

examples/connect.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<?php
2-
require_once "../vendor/autoload.php";
2+
require_once __DIR__ . "/../vendor/autoload.php";
33

4-
$c = new Nats\Connection();
4+
$connectionOptions = new \Nats\ConnectionOptions();
5+
$connectionOptions
6+
->setHost('localhost')
7+
->setPort(4222);
8+
$c = new Nats\Connection($connectionOptions);
59
$c->connect();
610
$c->close();

examples/ping.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
<?php
2-
require_once "../vendor/autoload.php";
2+
require_once __DIR__ . "/../vendor/autoload.php";
33

4-
const HOST = "localhost";
5-
const PORT = 4222;
4+
$connectionOptions = new \Nats\ConnectionOptions();
5+
$connectionOptions
6+
->setHost('localhost')
7+
->setPort(4222);
68

7-
echo "Server: nats://" . HOST . ":" . PORT . PHP_EOL;
8-
$c = new Nats\Connection();
9+
echo "Server: nats://" . $connectionOptions->getHost() . ":" . $connectionOptions->getPort() . PHP_EOL;
10+
11+
$c = new Nats\Connection($connectionOptions);
912
$c->connect();
1013

1114
$c->ping();

examples/pubsub/pub.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?php
2-
require_once "../../vendor/autoload.php";
2+
require_once __DIR__ . "/../../vendor/autoload.php";
33

4-
const HOST = "localhost";
5-
const PORT = 4222;
6-
7-
$c = new Nats\Connection();
4+
$connectionOptions = new \Nats\ConnectionOptions();
5+
$connectionOptions
6+
->setHost('localhost')
7+
->setPort(4222);
8+
$c = new Nats\Connection($connectionOptions);
89
$c->connect();
910

1011
$c->reconnect();

examples/pubsub/sub.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?php
2-
require_once "../../vendor/autoload.php";
2+
require_once __DIR__ . "/../../vendor/autoload.php";
33

4-
const HOST = "localhost";
5-
const PORT = 4222;
6-
7-
$c = new Nats\Connection();
4+
$connectionOptions = new \Nats\ConnectionOptions();
5+
$connectionOptions
6+
->setHost('localhost')
7+
->setPort(4222);
8+
$c = new Nats\Connection($connectionOptions);
89
$c->connect();
910

1011
$callback = function ($payload) {

0 commit comments

Comments
 (0)