phalanx-php/surreal 问题修复 & 功能扩展

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

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

phalanx-php/surreal

最新稳定版本:v0.6.2

Composer 安装命令:

composer require phalanx-php/surreal

包简介

SurrealDB RPC and live-query client for Phalanx using Iris, Hermes, and Aegis runtime supervision

README 文档

README

Native SurrealDB HTTP and live-query RPC integration for Phalanx through Iris, Hermes, and Aegis-managed waits.

Usage

<?php

use Phalanx\Application;
use Phalanx\Scope\ExecutionScope;
use Phalanx\Surreal\Surreal;
use Phalanx\Surreal\SurrealBundle;
use Phalanx\Task\Task;

Application::starting([])
    ->providers(new SurrealBundle())
    ->run(Task::named('olympus.query', static function (ExecutionScope $scope): void {
        $surreal = $scope->service(Surreal::class);

        $surreal->create('oracle:apollo', [
            'name' => 'Apollo',
            'domain' => 'prophecy',
        ]);
    }));

The SurrealBundle registers Surreal::class as the library entry point. Resolve it from the active task scope instead of manually constructing a client.

Surreal wraps the HTTP RPC surface used by the current package:

  • Connection/session: signin, signup, authenticate, invalidate, reset, info, ping, version, status, health, use
  • Querying: query, queryRaw, let, unset
  • Records: select, create, insert, insertRelation, update, upsert, merge, patch, delete, relate
  • Functions/live query cleanup: run, kill, rpc
  • Live queries: live, liveQuery

let() and unset() manage local HTTP query variables. Those variables are merged into later query() calls from this Surreal instance; they are not persistent WebSocket session variables.

withDatabase() returns a scoped variant for another namespace/database. use() sends Surreal's RPC use method and then updates this instance's local HTTP header context.

Live queries use Hermes' WebSocket client under the same scoped Surreal entry point. Once a live connection is open, session mutation methods such as signin, authenticate, use, let, and unset are rejected on that instance so the HTTP and WebSocket session state cannot diverge.

Run the in-memory SurrealDB demos:

composer demo:surreal

Run only the live-query demo:

composer demo:surreal:live

Part of the Phalanx monorepo.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固