muxi/muxi-php
Composer 安装命令:
composer require muxi/muxi-php
包简介
MUXI PHP SDK - Manage AI agent formations and interact with their runtime APIs
关键字:
README 文档
README
Official PHP SDK for MUXI — infrastructure for AI agents.
Highlights
- Pure PHP with curl (no external dependencies)
- Built-in retries, idempotency, and typed errors
- Streaming helpers for chat/audio and deploy/log tails
Need deeper usage notes? See the User Guide for streaming, retries, and auth details.
Requirements
- PHP 8.2+
- ext-curl
- ext-json
- ext-openssl
Installation
composer require muxi/muxi-php
Quick Start
Server Management (Control Plane)
<?php use Muxi\ServerClient; use Muxi\ServerConfig; $server = new ServerClient([ 'url' => getenv('MUXI_SERVER_URL'), 'keyId' => getenv('MUXI_KEY_ID'), 'secretKey' => getenv('MUXI_SECRET_KEY'), ]); // List formations $formations = $server->listFormations(); foreach ($formations['formations'] as $f) { echo "{$f['id']}: {$f['status']}\n"; } // Get server status $status = $server->status(); echo "Uptime: {$status['uptime']}s\n";
Formation Usage (Runtime API)
<?php use Muxi\FormationClient; // Connect via server proxy $client = new FormationClient([ 'formationId' => 'my-bot', 'serverUrl' => getenv('MUXI_SERVER_URL'), 'adminKey' => getenv('MUXI_ADMIN_KEY'), 'clientKey' => getenv('MUXI_CLIENT_KEY'), ]); // Or connect directly to formation $client = new FormationClient([ 'url' => 'http://localhost:8001', 'adminKey' => getenv('MUXI_ADMIN_KEY'), 'clientKey' => getenv('MUXI_CLIENT_KEY'), ]); // Chat (non-streaming) $response = $client->chat(['message' => 'Hello!'], 'user123'); echo $response['message']; // Chat (streaming) $client->chatStream(['message' => 'Tell me a story'], 'user123', function($event) { $data = json_decode($event['data'], true); if (isset($data['text'])) { echo $data['text']; } }); // Health check $health = $client->health(); echo "Status: {$health['status']}\n";
Webhook Verification
<?php use Muxi\Webhook; use Muxi\WebhookVerificationException; // In your webhook handler $payload = file_get_contents('php://input'); $signature = $_SERVER['HTTP_X_MUXI_SIGNATURE'] ?? ''; $secret = getenv('WEBHOOK_SECRET'); if (!Webhook::verifySignature($payload, $signature, $secret)) { http_response_code(401); echo json_encode(['error' => 'Invalid signature']); exit; } $event = Webhook::parse($payload); switch ($event->status) { case 'completed': foreach ($event->content as $item) { if ($item->type === 'text') { echo $item->text; } } break; case 'failed': echo "Error: {$event->error->message}\n"; break; case 'awaiting_clarification': echo "Question: {$event->clarification->question}\n"; break; }
Configuration
Environment Variables
MUXI_DEBUG=1- Enable debug logging
Client Options
$server = new ServerClient([ 'url' => 'https://muxi.example.com:7890', 'keyId' => 'your-key-id', 'secretKey' => 'your-secret-key', 'timeout' => 30, // Request timeout in seconds 'maxRetries' => 3, // Retry on 429/5xx errors 'debug' => true, // Enable debug logging ]);
Error Handling
use Muxi\NotFoundException; use Muxi\AuthenticationException; use Muxi\RateLimitException; use Muxi\MuxiException; try { $server->getFormation('nonexistent'); } catch (NotFoundException $e) { echo "Not found: {$e->getMessage()}\n"; } catch (AuthenticationException $e) { echo "Auth failed: {$e->getMessage()}\n"; } catch (RateLimitException $e) { echo "Rate limited. Retry after: {$e->retryAfter}s\n"; } catch (MuxiException $e) { echo "Error: {$e->getMessage()} ({$e->statusCode})\n"; }
License
MIT
muxi/muxi-php 适用场景与选型建议
muxi/muxi-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 02 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「sdk」 「agents」 「ai」 「muxi」 「formations」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 muxi/muxi-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 muxi/muxi-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 muxi/muxi-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Interactive CLI that generates customized Claude Code markdown files (CLAUDE.md, commands, agents) for PHP projects with Symfony, Laravel, Rector, PHPStan, PHP-CS-Fixer, GrumPHP and more.
Laravel architecture guidance, application audit, and guard tooling for AI coding agents.
This package will help you to handle multi device operations
Free, read-only Filament observability panel for Laravel Swarm — inspect swarm runs, steps, durable state, memory, streaming, and audit health from your app's Filament panel.
PHP SDK for the Enconvert file conversion API
支付宝开放平台v3协议文档,支持最新版PHP8+
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-02-11