KamiOrz / lumen-hprose by KamiOrz

Hprose client/server providers for lumen 5.x
Package Data
Maintainer Username: KamiOrz
Maintainer Contact: 68152283@qq.com (XiaoGai)
Package Create Date: 2016-12-25
Package Last Update: 2016-12-25
Language: PHP
License: MIT
Last Refreshed: 2022-07-03 15:04:19
Package Statistics
Total Downloads: 27
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

Hprose for Lumen 5.x

Hprose https://github.com/hprose

HPROSE is a High Performance Remote Object Service Engine.

It is a modern, lightweight, cross-language, cross-platform, object-oriented, high performance, remote dynamic communication middleware. It is not only easy to use, but powerful.


# composer
composer require kamiorz/lumen-hprose dev-master


# config/hprose.php
# bootstrap/app.php
# include the provider

# include the alias
class_alias('TKamiOrz\LumenHprose\HproseClientFacade', 'RpcClient');
class_alias('TKamiOrz\LumenHprose\HproseServerFacade', 'RpcServer');
class_alias('TKamiOrz\LumenHprose\HproseServiceFacade', 'RpcService');

# Lumen config
sudo cp vendor/kamiorz/lumen-hprose/config/hprose.php config


Hprose client

use RpcClient as Rpc;
$result = Rpc::someServerMethod($params);

Hprose server

Route::any('/api', function() {
    $server = app('RpcServer');
    // Hprose support XmlRPC and JsonRPC
    // if want support XmlRpc
    $server->addFilter(new Hprose\Filter\XMLRPC\ServiceFilter());
    // if want support JsonRpc
    $server->addFilter(new Hprose\Filter\JSONRPC\ServiceFilter());
    $server->addInstanceMethods(new \App\Services\SomeHprosePublishServices());

Middleware setting

# app/Http/Middleware/VerifyCsrfToken.php
protected $except = [
    'api' // OR 'api*'

API Reference

Please refer to https://github.com/hprose/hprose-php