https://github.com/znframework/package-socket
ZN Framework - Socket Package
https://github.com/znframework/package-socket
Last synced: about 1 month ago
JSON representation
ZN Framework - Socket Package
- Host: GitHub
- URL: https://github.com/znframework/package-socket
- Owner: znframework
- License: mit
- Created: 2020-05-15T15:53:34.000Z (almost 6 years ago)
- Default Branch: develop
- Last Pushed: 2025-01-05T14:16:29.000Z (about 1 year ago)
- Last Synced: 2025-01-05T14:38:28.870Z (about 1 year ago)
- Language: PHP
- Size: 25.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
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();
```