PHP code example of ibllex / hyperf-service-register

1. Go to this page and download the library: Download ibllex/hyperf-service-register 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/ */

    

ibllex / hyperf-service-register example snippets



...
return [
  	...
    'servers' => [
        [
            'name' => 'http',
            'type' => Server::SERVER_HTTP,
            'host' => '0.0.0.0',
            'port' => 9501,
            ...
            'publish' => [
                'protocol' => 'http',
                'name' => 'http-service',
            ],
        ],
        [
            'name' => 'grpc',
            'type' => Server::SERVER_HTTP,
            'host' => '0.0.0.0',
            ...
            'publish' => [
                'protocol' => 'grpc',
                'name' => 'grpc-service',
            ],
        ],
        [
            'name' => 'jsonrpc-http',
            'type' => Server::SERVER_HTTP,
            'host' => '0.0.0.0',
            'port' => 9504,
            ...
            'publish' => [
                'protocol' => 'jsonrpc-http',
                'name' => 'jsonrpc-http-service',
            ],
        ],
    ],
  	...
];


// You need to replace the 'grpc' parameter with your own grpc service name.
\iBllex\ServiceRegister\Grpc\Grpc::addHealthCheck('grpc');