1. Go to this page and download the library: Download lumening/lumen-hprose 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/ */
namespace App\Controllers;
class User
{
public function update($name)
{
return 'update name: ' . $name;
}
public function getUserById($id)
{
return [
'id'=>$id,
'name'=>'lumen',
'email'=>'',
'url'=>'http://www.lumen.fun',
];
}
}
$client = new \Hprose\Socket\Client('tcp://127.0.0.1:8888', false);
$client->getUserByName('lumen');
$client->userUpdate('lumen');