knik/gameap-daemon-client
Composer 安装命令:
composer require knik/gameap-daemon-client
包简介
GameAP Daemon PHP Client
README 文档
README
Installation
composer require knik/gameap-daemon-client
Usage
Commands
Connect to server
$gdaemonCommands = new GdaemonCommands([ 'host' => 'localhost', 'port' => 31717, 'serverCertificate' => '/path/to/server.crt', 'localCertificate' => '/path/to/client.crt', 'privateKey' => '/path/to/client.key.pem', 'privateKeyPass' => '1234', 'timeout' => 10, 'workDir' => '/home/user', ]); $gdaemonCommands->connect();
Execute command
$result = $gdaemonCommands->exec('echo HELLO'); var_dump($result); // string(5) "HELLO"
Exit code:
$result = $gdaemonCommands->exec('echo HELLO', $exitCode); var_dump($result); // string(5) "HELLO" var_dump($exitCode); // int(0)
Files
Connect to server
$gdaemonFiles = new GdaemonFiles([ 'host' => 'localhost', 'port' => 31717, 'serverCertificate' => '/path/to/server.crt', 'localCertificate' => '/path/to/client.crt', 'privateKey' => '/path/to/client.key.pem', 'privateKeyPass' => '1234', 'timeout' => 10, ]); $gdaemonFiles->connect();
Listing directory
Detail info about files
$result = $gdaemonFiles->directoryContents('/path/to/dir'); print_r($result); /* Array ( [0] => Array ( [name] => directory [size] => 0 [mtime] => 1542013640 [type] => dir [permissions] => 0755 ) [1] => Array ( [name] => file.txt [size] => 15654 [mtime] => 1542013150 [type] => file [permissions] => 0644 ) ) */
File names only
$result = $gdaemonFiles->listFiles('/path/to/dir'); print_r($result); Array ( [0] => directory [1] => file.txt )
Create directory
$gdaemonFiles->mkdir('/path/to/new_dir');
Remove
$gdaemonFiles->delete('/path/to/file.txt');
To remove a directory that contains other files or directories:
$gdaemonFiles->delete('/path/to/file.txt', true);
Rename
Rename or move files/directories
$gdaemonFiles->rename('/path/to/file.txt', '/path/to/new_name.txt');
Copy
$gdaemonFiles->copy('/path/to/file.txt', '/path/to/new_file.txt');
Change permission
$gdaemonFiles->chmod(0755, '/path/to/file.txt');
Exist checking
$gdaemonFiles->exist('/path/to/file.txt');
Metadata
$result = $gdaemonFiles->directoryContents('/path/to/file.txt'); print_r($result); /* Array ( [name] => file.txt [size] => 43 [type] => file [mtime] => 1541971363 [atime] => 1541971363 [ctime] => 1541971363 [permissions] => 0644 [mimetype] => text/plain ) */
Download file from server
$gdaemonFiles->get('/remote/path/to/file.txt', '/local/path/to/file.txt');
File handle:
$fileHandle = fopen('php://temp', 'w+b'); $gdaemonFiles->get('/remote/path/to/file.txt', $fileHandle);
Upload file
$gdaemonFiles->put('/local/path/to/file.txt', '/remote/path/to/file.txt');
File handle:
$fileHandle = fopen('/local/path/to/file.txt', 'r'); $gdaemonFiles->put($fileHandle, '/remote/path/to/file.txt');
Status
Connect to server
$gdaemonStatus = new GdaemonStatus([ 'host' => 'localhost', 'port' => 31717, 'serverCertificate' => '/path/to/server.crt', 'localCertificate' => '/path/to/client.crt', 'privateKey' => '/path/to/client.key.pem', 'privateKeyPass' => '1234', 'timeout' => 10, ]); $gdaemonStatus->connect();
GameAP Daemon Version
Get GameAP Daemon version and compilation date
$version = $gdaemonStatus->version();
Base Information
Get uptime info, number of working and waiting tasks, number of online servers list
$info = $gdaemonStatus->infoBase();
Details Information
Get uptime info, ID list of working and waiting tasks, ID list of online servers list
$info = $gdaemonStatus->infoDetails();
knik/gameap-daemon-client 适用场景与选型建议
knik/gameap-daemon-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7.41k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 11 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 knik/gameap-daemon-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 knik/gameap-daemon-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 7.41k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 4
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-11-12