mirror of
https://github.com/YGGverse/nex-php.git
synced 2026-04-01 18:25:28 +00:00
Compare commits
No commits in common. "main" and "1.1.0" have entirely different histories.
3 changed files with 8 additions and 25 deletions
10
README.md
10
README.md
|
|
@ -1,6 +1,6 @@
|
||||||
# nex-php
|
# nex-php
|
||||||
|
|
||||||
PHP 8 Library for NEX Protocol (see also [nps-php](https://github.com/YGGverse/nps-php))
|
PHP 8 Library for Nex Protocol (see also [nps-php](https://github.com/YGGverse/nps-php))
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
|
@ -10,7 +10,7 @@ composer require yggverse/nex
|
||||||
|
|
||||||
## Client
|
## Client
|
||||||
|
|
||||||
PHP interface for NEX protocol queries
|
PHP interface for Nex protocol queries
|
||||||
|
|
||||||
``` php
|
``` php
|
||||||
$client = new \Yggverse\Nex\Client;
|
$client = new \Yggverse\Nex\Client;
|
||||||
|
|
@ -41,7 +41,7 @@ var_dump(
|
||||||
|
|
||||||
## Server
|
## Server
|
||||||
|
|
||||||
Build interactive server instance to listen NEX protocol connections!
|
Build interactive server instance to listen Nex protocol connections!
|
||||||
|
|
||||||
``` php
|
``` php
|
||||||
$server = new \Yggverse\Nex\Server;
|
$server = new \Yggverse\Nex\Server;
|
||||||
|
|
@ -91,7 +91,3 @@ $server->start(
|
||||||
Stop server instance.
|
Stop server instance.
|
||||||
|
|
||||||
Same to `Server::setLive(false)`
|
Same to `Server::setLive(false)`
|
||||||
|
|
||||||
## Integrations
|
|
||||||
|
|
||||||
* [next](https://github.com/YGGverse/next) - PHP 8 Server for NEX Protocol
|
|
||||||
|
|
@ -113,10 +113,7 @@ class Client
|
||||||
sprintf(
|
sprintf(
|
||||||
"%s%s\r\n",
|
"%s%s\r\n",
|
||||||
$this->_path,
|
$this->_path,
|
||||||
$this->_query ? sprintf(
|
|
||||||
'?%s',
|
|
||||||
$this->_query
|
$this->_query
|
||||||
) : null
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -108,17 +108,14 @@ class Server
|
||||||
STREAM_SERVER_BIND | STREAM_SERVER_LISTEN
|
STREAM_SERVER_BIND | STREAM_SERVER_LISTEN
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($this->_live)
|
|
||||||
{
|
|
||||||
$this->_live = is_resource(
|
|
||||||
$socket
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (!$this->_live)
|
if (!$this->_live)
|
||||||
{
|
{
|
||||||
|
fclose(
|
||||||
|
$socket
|
||||||
|
);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -163,13 +160,6 @@ class Server
|
||||||
);
|
);
|
||||||
|
|
||||||
} while ($this->_live);
|
} while ($this->_live);
|
||||||
|
|
||||||
if (is_resource($socket))
|
|
||||||
{
|
|
||||||
fclose(
|
|
||||||
$socket
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function stop(): void
|
public function stop(): void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue