myvariety/wisp-sdk
Composer 安装命令:
composer require myvariety/wisp-sdk
包简介
Wisp SDK
README 文档
README
This is an SDK that integrates with APIs from Pterodactyl Pterodactyl v0.7 API Docs. Will eventually support the Wisp API
Installation | COMING SOON
You can install the SDK via composer:
composer require myvariety/wisp-sdk
Usage
Initializing the API
$useSsl = true;
$api = new \MyVariety\WispSDK\WispApi('API_KEY', 'PANEL_URL', $useSsl);
One thing to note is that the Pterodactyl Panel has two API's: The application API and the account API. The account API/key should be used to access the Client requestor, while the application API/key should be used for all other requestors.
Loading a Requestor
Requestor definition: A class that the SDK uses to access API endpoints of a particular type (e.g. Servers, Nests, or Locations).
The SDK utilizes PHP's __get() magic method so requestors can just be accessed as a property of the loaded api. For example:
$clientRequestor = $api->Client;
Calling an Endpoint
All endpoints exist as a method on a requestor. For example, the application/locations/ endpoint would be called as follows:
$locationResponse = $api->Locations->getAll();
Or to call the same endpoint but with post parameters to add a new location, it would look like this:
$locationResponse = $api->Locations->add($parameters);
Using a response object
The response object is meant to make it easier to Access the returned data and recognize when you have encountered errors. It has the following methods:
$locationResponse->raw(); // Useful for logging the full response from Pterodactyl
$locationResponse->response(); // The json decoded data returned
$locationResponse->headers(); // An array of http headers returned
$locationResponse->status(); // The status code returned
$locationResponse->errors(); // An array of the errors returned
The most used methods are typically response() and errors()
$errors = $locationResponse->errors();
if (empty($errors)) {
$locations = $locationResponse->response();
...
...
...
}
myvariety/wisp-sdk 适用场景与选型建议
myvariety/wisp-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 05 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 myvariety/wisp-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 myvariety/wisp-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2023-05-05