orchestratexr/botman-chat-sdk
Composer 安装命令:
composer require orchestratexr/botman-chat-sdk
包简介
Drop-in chat-widget UI and multi-channel adapter framework on top of the Laravel AI SDK.
README 文档
README
A Laravel package that gives any host app a drop-in chat-widget UI plus a thin multi-channel adapter framework on top of the Laravel AI SDK.
SuperBotMan is the evolution of the prior orchestratexr/botman-chat-sdk package. The widget UI carried over; the LLM back-end (previously a hand-rolled BotMan + LLPhant integration) has been replaced by laravel/ai. See CHANGELOG.md for the full break-down — anything BotMan- or LLPhant-related is gone.
What you get
- A bundled Vue chat widget (beacon + popup/docked iframe) that drops onto any Laravel page with one Blade directive.
- A
Channelabstraction so the same agent code can serve the Web widget today, and Slack / Discord / your-transport-of-choice tomorrow, without the agents needing to know. - An
AgentRegistryso registering an agent and getting auto-mounted routes (POST endpoint, conversation list/show/delete) is three lines in yourAppServiceProvider. - A CLI (
php artisan super-botman:chat {slug}) for testing a registered agent end-to-end without a browser, complete with--continue/--conversation-id/--systemflags.
What it isn't
- Not an LLM framework. Agents, tools, providers, structured output, streaming — all of that is
laravel/ai's job. SuperBotMan is the integration shell around it. - Not opinionated about persistence. Conversation history lives in
laravel/ai'sagent_conversations/agent_conversation_messagestables. SuperBotMan just exposes them through HTTP endpoints the widget understands. - Not a multi-tenant agent marketplace. It's a tool for the host app's own developers to wire up agents. There's no UI for end-users to register their own.
Installation
composer require orchestratexr/super-botman laravel/ai
Publish the package's config, views, and built JS/CSS assets, then run migrations:
php artisan vendor:publish --tag=super-botman-config
php artisan vendor:publish --tag=super-botman-views
php artisan vendor:publish --tag=super-botman-assets
php artisan vendor:publish --provider="Laravel\Ai\AiServiceProvider"
php artisan migrate
Add an Anthropic (or other Lab provider) key to your .env:
ANTHROPIC_API_KEY=sk-ant-...
The 3-line host-app integration
Drop these in AppServiceProvider::boot():
use OrchestrateXR\SuperBotMan\Facades\SuperBotMan; use OrchestrateXR\SuperBotMan\Channels\WebChannel; SuperBotMan::registerAgent('chat', \App\Agents\ChatAgent::class) ->channel(WebChannel::class);
That auto-registers:
| Method | URL | Purpose |
|---|---|---|
POST |
{mount}/chat |
Agent endpoint (the widget posts here) |
GET |
{mount}/chat/conversations |
List the current user's conversations |
GET |
{mount}/chat/conversations/{id} |
Fetch a conversation's messages (for resume) |
DELETE |
{mount}/chat/conversations/{id} |
Delete a conversation |
{mount} defaults to /chat and is configurable in config/super-botman.php.
Drop the widget onto any Blade page:
@superbotman
Define your agent as a normal laravel/ai Agent class:
namespace App\Agents; use Laravel\Ai\Attributes\Provider; use Laravel\Ai\Attributes\Model; use Laravel\Ai\Concerns\RemembersConversations; use Laravel\Ai\Contracts\Agent; use Laravel\Ai\Contracts\Conversational; use Laravel\Ai\Enums\Lab; use Laravel\Ai\Promptable; #[Provider(Lab::Anthropic)] #[Model('claude-sonnet-4-5')] class ChatAgent implements Agent, Conversational { use Promptable, RemembersConversations; public function instructions(): string { return 'You are a helpful assistant.'; } }
Customizing user identity
Most apps will want to override how SuperBotMan identifies the visitor — for naming the echo channel, for scoping conversation history, and for telling laravel/ai which user owns the conversation. Extend the default configurator and bind your subclass:
namespace App\Services; use OrchestrateXR\SuperBotMan\SuperBotManConfigurator; use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Facades\Auth; class MyChat extends SuperBotManConfigurator { public function agentUser(): Authenticatable { return Auth::user() ?? parent::agentUser(); } public function isAnonymous(Authenticatable $user): bool { // E.g. for an app that authenticates everyone as a real user // and uses an `is_anonymous` flag for the shared visitor account: return $user->is_anonymous ?? parent::isAnonymous($user); } }
// AppServiceProvider::register() $this->app->singleton( \OrchestrateXR\SuperBotMan\Contracts\SuperBotManConfigurator::class, fn ($app) => new \App\Services\MyChat($app), );
If your User model uses a non-standard primary key column, that's already handled — SuperBotMan wraps the user in a ConversationParticipant adapter before handing it to the SDK.
Anonymous visitors
Two patterns are supported out of the box:
- Your app already authenticates every visitor as a real
Userrow (e.g. an "Anonymous User" account that unauthenticated sessions get). OverrideagentUser()to returnAuth::user()and you're done. SuperBotMan never touches its own anonymous table. - Your app has no anonymous-user concept. The default configurator will get-or-create a row in
super_botman_anonymous_userskeyed by a session UUID and return that. When the visitor signs in, your app can run a "claim" step to reassign theiragent_conversations.user_idfrom the anonymous row to the real user (helper to follow).
The Laravel AI SDK requires agent_conversations.user_id to be non-null and reference a real Authenticatable; this design is the workaround.
Multi-channel
The package ships only WebChannel today. To add Slack / Discord / etc., implement OrchestrateXR\SuperBotMan\Contracts\Channel:
interface Channel { public function inbound(Request $request): InboundMessage; public function outbound(AgentRunResult $result, ClientActionBag $actions, InboundMessage $inbound): Response; public function middleware(): array; // ['web'], ['api', 'slack.signature'], ... public function endpoints(): array; // [['POST', '/']], or multi-endpoint public function supportsConversationHistory(): bool; }
Then register an agent with that channel:
SuperBotMan::registerAgent('support', \App\Agents\SupportAgent::class) ->channel(\App\Channels\SlackChannel::class) ->middleware(['slack.signature']);
The same agent code runs over either transport.
Configuration
config/super-botman.php (after publishing) covers the widget's appearance + the route mount prefix. The agent registry — which agents exist, what URL they live at, what channel serves them — is populated by your code calling SuperBotMan::registerAgent(...), not by config.
Testing
composer test
Contributing
See CONTRIBUTING.
Security
If you discover any security related issues, please email acollegeman@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). See LICENSE.
About OrchestrateXR
OrchestrateXR is the easiest way to create and deploy XR content. Use your web browser to create for mobile, tablets, PCs and XR devices.
orchestratexr/botman-chat-sdk 适用场景与选型建议
orchestratexr/botman-chat-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 08 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「chat」 「laravel」 「widget」 「Agent」 「ai」 「vue」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 orchestratexr/botman-chat-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 orchestratexr/botman-chat-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 orchestratexr/botman-chat-sdk 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This simple PHP class allows you to easily generate Smartsupp.com JS chat code.
Yii2 LightBox image galary widget uses Lightbox v2.10.0 by Lokesh Dhakar
Client for the REST API plugin of the OpenFire Server
Add a weather widget to Flarum
The Yii2 extension module to chat registered users.
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 24
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-05