Compare commits

..

8 commits
1.1.0 ... main

Author SHA1 Message Date
yggverse
1129cd1657 fix query format 2024-07-08 05:01:59 +03:00
yggverse
55b4c879e4 add socket active validation 2024-04-27 16:10:49 +03:00
yggverse
7923fea04e update readme 2024-04-27 01:20:49 +03:00
yggverse
1aa260b41d update readme 2024-04-27 01:18:12 +03:00
yggverse
406911794d update readme 2024-04-27 01:15:52 +03:00
yggverse
f80b114f1a update readme 2024-04-27 01:14:05 +03:00
yggverse
6795d37fa8 update readme 2024-04-27 01:11:17 +03:00
yggverse
3f2b2cbc54 update readme 2024-04-27 01:09:45 +03:00
3 changed files with 25 additions and 8 deletions

View file

@ -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,3 +91,7 @@ $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

View file

@ -113,7 +113,10 @@ class Client
sprintf( sprintf(
"%s%s\r\n", "%s%s\r\n",
$this->_path, $this->_path,
$this->_query $this->_query ? sprintf(
'?%s',
$this->_query
) : null
) )
); );

View file

@ -108,14 +108,17 @@ 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;
} }
@ -160,6 +163,13 @@ class Server
); );
} while ($this->_live); } while ($this->_live);
if (is_resource($socket))
{
fclose(
$socket
);
}
} }
public function stop(): void public function stop(): void