pjz9n/pterodactyl-php-sdk
Composer 安装命令:
composer require pjz9n/pterodactyl-php-sdk
包简介
Simple and lightweight Pterodactyl API SDK
README 文档
README
Overview
Language:
English
Simple and lightweight Pterodactyl API SDK
Feature
- Simply SDK
- Clean code
- No dependency on other libraries
- use the complement function of the IDE
- Can be used intuitively
- Object-oriented code
Supported Action
Client API:
- Get All Servers
- Get Server (By ID)
- Get Resource (For example, get the amount of memory currently used)
- Send Console Command
- Send Power Action (For example, server start)
Application API:
- User
- Get All Users
- Get User (By ID)
- Get User (By External ID)
- Create User
- Edit User
- Delete User
- Nodes
- Now Development...
How to use
Run the following command in the command line
composer require pjz9n/pterodactyl-php-sdk
Write the code!
<?php declare(strict_types=1); require_once __DIR__ . "/vendor/autoload.php"; $url = "https://panel.example.com/api"; $key = "API Key"; $clientAPI = new \PJZ9n\PterodactylSDK\ClientAPI($url, $key); echo "Server Counts: "; try { echo count($clientAPI->getServers()) . PHP_EOL; } catch (\PJZ9n\PterodactylSDK\Errors\PterodactylSDKError $pterodactylSDKError) { echo "Error: " . $pterodactylSDKError->getMessage(); } $serverID = "1ab234c5"; echo "Start Server" . PHP_EOL; try { $clientAPI->sendPowerAction($serverID, \PJZ9n\PterodactylSDK\Variables\PowerAction\PowerAction::POWERACTION_START); } catch (\PJZ9n\PterodactylSDK\Errors\PterodactylSDKError $pterodactylSDKError) { echo "Error: " . $pterodactylSDKError->getMessage(); } echo "Server Memory Limit: "; try { echo $clientAPI->getResource($serverID)->getMemory()->getLimit() . "MB" . PHP_EOL; } catch (\PJZ9n\PterodactylSDK\Errors\PterodactylSDKError $pterodactylSDKError) { echo "Error: " . $pterodactylSDKError->getMessage(); } /* * Result * * Server Counts: 100 * Start Server * Server Memory Limit: 1000MB */
日本語
シンプルで軽量なPterodactyl APIのSDK
特徴
- シンプルなSDK
- クリーンなコード
- 他ライブラリへの依存性無し
- IDEによる補完を利用できる
- 直観的に扱える
- オブジェクト指向なコード
サポートしている操作
Client API:
- 全てのサーバーを取得
- サーバーを取得 (IDから)
- リソースを取得 (例えば、現在使っているメモリの量を取得)
- コンソールコマンドを送信
- 電源アクションを送信 (例えば、サーバーの起動)
Application API:
- User
- 全てのユーザーを取得
- ユーザーを取得 (IDから)
- ユーザーを取得 (External IDから)
- ユーザーを作成
- ユーザーを編集
- ユーザーを削除
- Nodes
- 開発中...
使い方
コマンドラインで以下のコマンドを実行する
composer require pjz9n/pterodactyl-php-sdk
コードを書く!
<?php declare(strict_types=1); require_once __DIR__ . "/vendor/autoload.php"; $url = "https://panel.example.com/api"; $key = "API Key"; $clientAPI = new \PJZ9n\PterodactylSDK\ClientAPI($url, $key); echo "Server Counts: "; try { echo count($clientAPI->getServers()) . PHP_EOL; } catch (\PJZ9n\PterodactylSDK\Errors\PterodactylSDKError $pterodactylSDKError) { echo "Error: " . $pterodactylSDKError->getMessage(); } $serverID = "1ab234c5"; echo "Start Server" . PHP_EOL; try { $clientAPI->sendPowerAction($serverID, \PJZ9n\PterodactylSDK\Variables\PowerAction\PowerAction::POWERACTION_START); } catch (\PJZ9n\PterodactylSDK\Errors\PterodactylSDKError $pterodactylSDKError) { echo "Error: " . $pterodactylSDKError->getMessage(); } echo "Server Memory Limit: "; try { echo $clientAPI->getResource($serverID)->getMemory()->getLimit() . "MB" . PHP_EOL; } catch (\PJZ9n\PterodactylSDK\Errors\PterodactylSDKError $pterodactylSDKError) { echo "Error: " . $pterodactylSDKError->getMessage(); } /* * 結果 * * Server Counts: 100 * Start Server * Server Memory Limit: 1000MB */
pjz9n/pterodactyl-php-sdk 适用场景与选型建议
pjz9n/pterodactyl-php-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 03 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 pjz9n/pterodactyl-php-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 pjz9n/pterodactyl-php-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-v3
- 更新时间: 2020-03-08