Package Data | |
---|---|
Maintainer Username: | minxinqing |
Package Create Date: | 2016-12-30 |
Package Last Update: | 2017-10-11 |
Home Page: | |
Language: | PHP |
License: | Unknown |
Last Refreshed: | 2025-02-06 03:05:40 |
Package Statistics | |
---|---|
Total Downloads: | 475 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 1 |
Total Watchers: | 1 |
Total Forks: | 1 |
Total Open Issues: | 0 |
#已放弃,如果把laravel框架作为常驻内存模式使用,内存溢出严重
基于swoole扩展的rpc组件,能够轻松把laravel http接口转变成rpc服务。
swoole 1.8 +
laravel 5.1 +
composer require minxinqing/rpcwsw
服务端编写好http接口,如已写好GET接口 /news/list
增加config\rpcwsw.php配置文件
<?php
return [
'server' => [
'host' => '0.0.0.0',
'port' => 9527,
'pid_file' => storage_path('app/swoole_pid'),
'log_file' => storage_path('logs/swoole_log'),
'daemonize' => 1,
'worker_num' => 10,
'task_worker_num' => 10,
]
];
以上配置只是范例,所有配置参数可上 swoole官网查看
app\Console\Kernel.php注册命令
protected $commands = [
...
\Rpcwsw\Server::class,
];
server启动
php artisan rpcwsw:server start
增加config\rpcwsw.php配置文件
<?php
return [
'instance' => [
'serverA' => [
'host' => '0.0.0.0',
'port' => 9527,
]
],
];
调用服务
$v = \Rpcwsw\server('serverA')->api('news/list', [], 'get');