定制 easyswoole/console 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

easyswoole/console

Composer 安装命令:

composer require easyswoole/console

包简介

An efficient swoole framework

README 文档

README

composer require easyswoole/console

Server

use EasySwoole\Console\Console;
use EasySwoole\Console\ModuleInterface;
$http = new swoole_http_server("127.0.0.1", 9501);

$http->on("request", function ($request, $response) {
    $response->header("Content-Type", "text/plain");
    $response->end("Hello World\n");
});

/*
 * 开一个tcp端口给console 用
 */
$tcp = $http->addlistener('0.0.0.0',9600,SWOOLE_TCP);
/*
 * 实例化一个控制台,设置密码为123456
 */
$console = new Console('myConsole','123456');

/*
 * 定义自己的一个命令
 */

class Test implements ModuleInterface
{

    public function moduleName(): string
    {
        return 'test';
    }

    public function exec(array $arg, int $fd, Console $console)
    {
       return 'this is test exec';
    }

    public function help(array $arg, int $fd, Console $console)
    {
        return 'this is test help';
    }
}

/*
 * 命令注册
 */

$console->moduleContainer()->set(new Test());
/*
 * 依附给server
 */
$console->protocolSet($tcp)->attachToServer($http);

$http->start();

Client

telnet 127.0.0.1 9600

鉴权

auth {PASSWORD}

执行命令

{MODULE} {ARG1} {ARG2}

统计信息

  • 总下载量: 7.91k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 0
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2019-03-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固