1. Go to this page and download the library: Download hprose/hprose-swoole library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hprose / hprose-swoole example snippets
Hprose\Swoole\Server;
function hello($name) {
return 'Hello ' . $name;
}
$server = new Server('http://0.0.0.0:80/');
$server->addFunction('hello');
$server->start();
Hprose\Swoole\Server;
function hello($name) {
return 'Hello ' . $name;
}
$server = new Server('tcp://0.0.0.0:2016');
$server->addFunction('hello');
$server->start();
Hprose\Swoole\Server;
function hello($name) {
return 'Hello ' . $name;
}
$server = new Server('unix:/tmp/my.sock');
$server->addFunction('hello');
$server->start();
Hprose\Swoole\Server;
function hello($name) {
return 'Hello ' . $name;
}
$server = new Server('ws://0.0.0.0:8000/');
$server->addFunction('hello');
$server->start();