所属分类:php教程
基于 hprose/hprose-php 开发的 Laravel 扩展:laravel-hprose
https://github.com/fendui/laravel-hprose
composer require fendui/laravel-hprose dev-master
在 config/app.php
注册 HproseServiceProvider
'providers' => [ ..... \fendui\HproseServiceProvider::class ]
php artisan vendor:publish --provider="fendui\HproseServiceProvider"
\fendui\Facades\HproseRoute::add(function () { return 'service hello'; }, 'hello'); \fendui\Facades\HproseRoute::add(\fendui\demoService::class);
php artisan hprose:socket
$uris =['tcp://127.0.0.1:1314']; $client = new \fendui\Clients\SocketClient($uris, false); $client->hello() $client->fendui_demoService->kan() 需要配置配置 'client' => [ 'tcp_uris' => [ 'tcp://127.0.0.1:1314', ], 'async' => false ], app('hprose.socket.client')->hello()
demo 查看注册的方法
http://127.0.0.1:8000/rpc
可以通过路由查看调用方式
http://127.0.0.1:8000/rpc/kan http://127.0.0.1:8000/rpc/demo/say http://127.0.0.1:8000/rpc/demo/kan http://127.0.0.1:8000/rpc/demo/can
相关推荐:最新的五个Laravel视频教程
以上就是分享一个好用的Laravel 扩展(laravel-hprose)的详细内容,更多请关注zzsucai.com其它相关文章!