Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/znframework/package-socket

ZN Framework - Socket Package
https://github.com/znframework/package-socket

Last synced: 9 days ago
JSON representation

ZN Framework - Socket Package

Awesome Lists containing this project

README

        

ZN Framework Socket Package



Follow the steps below for installation and use.

Installation



You only need to run the following code for the installation.

```
composer require znframework/package-socket
```

Documentation


Click for server documentation of your library.


Click for client documentation of your library.

Example Usage



Basic level usage is shown below.

```php
live(function($socket)
{
switch( $socket->read() )
{
case 'exit' : $socket->write('Goodbye!'); return;
case 'write': $socket->write('Run write command.'); break;
case 'read' : $socket->write('Run read command.'); break;

default : return;
}
});

# File: client.php
$socket = ZN\Socket\Client::run('tcp', '127.0.0.1', 8080);

$socket->write($command);

echo $socket->read();
```