surrealtech/threehats-api-php-wrapper
Composer 安装命令:
composer require surrealtech/threehats-api-php-wrapper
包简介
A PHP client for interacting with the Foundry VTT REST API
README 文档
README
The DND and Session modules are still under development. They are currently written but not tested, although that will be remedied after I'm done writing the CPR companion app
Foundry VTT REST API Client
A PHP client for interacting with the ThreeHats Foundry VTT REST API. This client provides a comprehensive set of methods to interact with the Foundry VTT REST API, making it easy(?) to integrate Foundry VTT with your PHP applications.
Installation
You can install the package via composer:
composer require surrealtech/foundry-api-php-client
Usage
require_once __DIR__ . '/vendor/autoload.php'; // If needed
use FoundryClient\FoundryClient;
// Initialize the client with your API key and base URL
$wrapper = new FoundryClient(
'https://foundryvtt-rest-api-relay.fly.dev',
'your-api-key'
);
// Get the API status
$status = $wrapper->getApiStatus();
//If it returns the status of "OK", congrats the wrapper is good to go.
/*
* I've included a (somewhat unnecessary and overengineered) prettyfier for any JSON output
* Most functions' last parameter will be the prettify param, false as default
* To display it correctly I've included a rip of the CSS from my project
* Either paste it into your stylesheet or use this to put it on page:
* Aside from looking nice, it replaces a whole JSON with html + enables a Copy function for most IDs and UUIDs.
* Useful for testing and messing around
*/
echo "<style>";
require_once __DIR__ . '/src/style.css';
echo "</style>";
// Get connected clients - save ID to a var or database
// Any ID will be copy&paste clickable when prettify is enabled.
$clients = $wrapper->api->getClients(true); //Bool to enable prettify
echo '<pre>'; print_r($clients); echo '</pre>'; //Include the pre tags for any return call
// Search for entities
$searchResults = $wrapper->entity->searchEntities('your-client-id', 'search-query', 'filter');
// Delete an entity
$deleteResult = $wrapper->entity->deleteEntity('your-client-id', 'entity-uuid');
// ... and many more methods for interacting with the Foundry VTT REST API
Wrapper Documentation
For detailed documentation of all available methods, including parameters, return values, and example usage, please see the Wrapper Documentation.
Requirements
- PHP 8.0 or higher
- GuzzleHttp 7.0 or higher
How to use Foundry REST API - Pasted from their github, please check it out!
- Install the Foundry VTT Module (https://github.com/ThreeHats/foundryvtt-rest-api)
- Get an API key for the public relay server at https://foundryvtt-rest-api-relay.fly.dev/
- Each request must have your API key in the "x-api-key" header, except for /api/status and /api/docs.
- Endpoints other than /clients require a clientId parameter that matches a connected world.
License
The MIT License (MIT). Please see License File for more information.
surrealtech/threehats-api-php-wrapper 适用场景与选型建议
surrealtech/threehats-api-php-wrapper 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 22 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 06 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 surrealtech/threehats-api-php-wrapper 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 surrealtech/threehats-api-php-wrapper 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 22
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-06-26