surrealtech/threehats-api-php-wrapper 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

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!

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-06-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固