01 / THE SIGNAL

我们发现了什么

Show HN:phpClaw— 配备工具、记忆和防护机制的PHP AI智能体运行时。0.x 分支 标签 转到文件 代码 打开更多操作菜单 最新提交 历史 111次提交 111次提交 文件夹和文件 名称 名称 最后提交信息 最后提交日期 .github .github packages packages .editorconfig .editorconfig .gitattributes .gitattributes .gitignore .gitignore LICENSE

  • 来源:Hacker News(发现于 2026-10-30)
  • 证据等级:D · 发现产品或需求信号,暂未获得可核验的商业证据。
  • 商业模式:待核验
  • 主题:AI Agent
  • 初筛评分:15.2/100 · 收录 1 次
#工作流自动化#待验证#产品发现
02 / SOURCE & EVIDENCE

证据,比故事更重要。

发现产品或需求信号,暂未获得可核验的商业证据。

规则清洗与初筛,未经人工商业核验。原文语境、实际客户和付费情况仍需自行验证。

引用与数字披露

来源类型(原作者自述/第三方测算/媒体转引)需采集端标注,本版尚未落字段。

短句引用
作者
未标注
抓取日期
来源类型
未标注
数字口径
币种
未标注
口径
未标注
披露主体
未标注
披露日期
未标注

中文辅助译文(节选·触顶截断)

0.x

分支 标签

转到文件

代码 打开更多操作菜单

最新提交

历史

111 次提交

111 次提交

文件夹和文件

名称 名称 最后提交信息

最后提交日期

.github

.github

packages

packages

.editorconfig

.editorconfig

.gitattributes

.gitattributes

.gitignore

.gitignore

LICENSE

LICENSE

Makefile

Makefile

README.md

README.md

composer.json

composer.json

查看所有文件

仓库文件导航

phpclaw 浅色模式标志
phpclaw 浅色模式标志
phpclaw 深色模式标志
phpclaw 深色模式标志

核心测试 图注:核心测试工作流状态。

PHP 版本 图注:PHP 版本要求为 8.1。

许可证:MIT 图注:采用 MIT 许可证。

版本 图注:当前软件包版本。

下载量 图注:GitHub Releases 下载总数。

适用于 PHP 的通用 AI 智能体引擎。

工具、记忆、安全防护和 ReAct 循环均已内置。核心零框架依赖。支持任意大语言模型提供商。

文档 · 适配器 · 为什么选择 phpClaw · 安装 · MCP · 安全

phpClaw 演示:执行 composer require phpclaw/phpclaw-laravel,随后智能体调用真实的 shell 工具检查磁盘使用情况并清理日志 图注:phpClaw 智能体调用真实 shell 工具检查磁盘使用情况并清理日志的演示。

数秒内启动智能体

composer require phpclaw/phpclaw export ANTHROPICAPIKEY= " sk-ant-... "

$ agent = PhpClaw \Claw:: builder ()-> build (); echo $ agent -> send ( ' What can you help me with? ' )-> text ;

一个环境变量、一个构建器,一次 send() 调用。构建器依次检查 ANTHROPICAPIKEY、OPENAIAPIKEY、GROQAPIKEY、GEMINIAPIKEY、MISTRALAPIKEY、DEEPSEEKAPIKEY、OLLAMA_HOST,并使用最先找到的可用项。无需 YAML,无需学习智能体框架,也不受供应商锁定。

为智能体配备工具

没有工具的智能体只能交谈。注册应用所需的工具,它便能开始执行实际工作:

use PhpClaw \ Claw ; use PhpClaw \ Tools \ ShellTool ; use PhpClaw \ Tools \ HttpTool ; use PhpClaw \ Tools \ FileReadTool ; use PhpClaw \ Tools \ DatabaseQueryTool ; use PhpClaw \ Tools \ CodeSearchTool ;

$ agent = Claw:: builder () -> tools ([ new ShellTool (allowlist: [ ' ls ' , ' df ' , ' tail ' ]), new HttpTool (), new FileReadTool (), new DatabaseQueryTool ( $ pdo ), new CodeSearchTool (), ]) -> build ();

检查磁盘使用情况并显示错误日志的最后 20 行 api.example.com 目前响应是否正常? 执行只读 SELECT,统计今天的订单 找出此代码库中所有使用 UserService 的位置

智能体会决定调用哪些工具以及调用顺序,并运行 ReAct 循环(推理、行动、观察、重复),直至获得答案或达到迭代上限。无论工具连接的是 shell、数据库、HTTP API 还是代码库,其行为完全相同。

为什么选择 phpClaw

每一篇“PHP 中的 AI”教程最后都采用相同的做法:在提供商 API 外面拼装一个 HTTP 客户端,手写一个工具调用循环,然后祈祷提示词在生产环境中仍然可靠。通用大语言模型 SDK 为你提供 API 客户端;phpClaw 则提供围绕它的智能体运行时:循环、防护措施、记忆和框架接线均已组装完毕。

phpClaw

通用大语言模型 SDK

工具调用循环

内置 ReAct

需要自行编写

原生框架适配器

每个框架 8 种惯用实现

无

提示注入防护

默认 8 项防护措施,并可选择启用速率限制

无

记忆抽象

可替换的驱动程序

无

流式输出与工具调用并行

混合模式

因实现而异

内置 MCP 服务器

可将任意应用暴露给 Claude Desktop

无

链式流程和多智能体图

Pipeline 和 Graph:循环、人工暂停与恢复、扇出

需要自行构建

核心零框架依赖

只需 ext-curl、ext-json、ext-mbstring

取决于所用框架

核心许可证

MIT,不设受限功能

因实现而异

phpClaw 并不追求面面俱到。它不是 RAG 框架,不包含嵌入或向量存储。它的设计目标是为大语言模型提供工具、记忆以及针对真实应用的安全控制,并在一次调用不足以完成任务时,将这些智能体串联为流水线或图。

phpClaw 提供什么

智能体运行时。ReAct 循环设有硬性迭代上限(maxiterations,默认 20),支持可插拔工具、可插拔记忆,以及模型可按需通过 loadskill 工具加载的技能;所有功能均在一个推理周期内运行。

流水线和图。Pipeline 将多个步骤(提示词模板、智能体、结构化输出、自定义可调用对象)串联起来,并提供重试和回退机制。Graph 运行可循环、分支、等待人工介入、在另一进程中恢复以及扇出的节点;分支既可内联运行,也可由 cron、队列或 CLI 启动的工作进程处理。参见“流水线和图”。

提供商灵活性。可通过环境变量自动检测 7 家提供商:Anthropic、OpenAI、Groq、Gemini、Mistral、DeepSeek、Ollama。同时支持自定义兼容 OpenAI 的端点,可通过 PHPCLAW_PROVIDER=custom 选择启用。使用 ->provider() 和 ->model() 即可切换提供商,无需修改其他位置的代码。

生产环境控制。默认启用 8 项安全防护措施(提示注入、个人身份信息、代码注入、Unicode、同形异义字符、角色切换、破坏性 SQL、消息长度),另提供可选择启用的速率限制防护。ToolOutputGuard 无条件清理工具输出,且位于防护注册表之外;大语言模型输出清理默认开启,可通过 ->sanitiseOutput(false) 禁用。ShellTool 仅允许使用白名单命令,并采用不可覆盖的硬编码命令阻止列表。HttpTool 验证解析后的 IP,而不只是主机名,从而弥补仅使用前缀阻止列表时会遗漏的 DNS 重绑定漏洞。FileReadTool / FileWriteTool 受工作区沙箱限制,并拒绝访问敏感路径和扩展名。

开发者体验。逐词元流式输出、提示缓存(缓存输入词元按 Anthropic 的折扣缓存读取费率计费,确切数值请参阅 Anthropic 定价),以及扩展思考(Claude 的推理链通过 $response->thinking 暴露)。

生态系统。提供 8 种框架和 CMS 适配器,一个用于将工具暴露给 Claude Desktop 和 Claude Code 的 MCP 服务器,以及可选的云传输层,用于承载持续更新的提示扫描防护服务。

框架与 CMS 适配器

每种适配器都按照宿主平台自身的惯用方式接入 phpClaw:Laravel 使用 Eloquent,Symfony 使用 Doctrine,WordPress 使用 WP-CLI,Drupal 使用 Drush,等等。每个适配器都提供管理后台聊天或 CLI,并在底层使用相同的 3 表记忆模式。

平台

软件包

安装方式

版本

Laravel

phpclaw/phpclaw-laravel

Composer

10、11、12、13

Symfony

phpclaw/phpclaw-symfony

Composer

6.4、7.x、8.x

Drupal

phpclaw/phpclaw-drupal

Composer

10、11

Magento / Adobe Commerce

phpclaw/phpclaw-magento

Composer

2.4.x

WordPress + WooCommerce

--

ZIP 上传

6.2+

Joomla

--

ZIP 上传

4、5、6

OpenCart

--

ZIP 上传

3.x、4.x

PrestaShop

--

ZIP 上传

8.x、9.x

CMS 适配器通过 Releases 以 ZIP 形式下载,而非通过 Composer 分发,因为其宿主平台正是通过这种方式安装扩展。

php artisan phpclaw " deploy staging and notify #ops " # Laravel bin/console phpclaw " check all database connections " # Symfony drush phpclaw:run " list recently-active users " # Drupal bin/magento phpclaw:run " check order-queue status " # Magento wp phpclaw send " summarise today's posts " # WordPress php cli/joomla.php phpclaw " list recent articles " # Joomla php cli/phpclaw.php send " check low stock products " # OpenCart php modules/phpclaw/cli/phpclaw.php send " check stock levels " # PrestaShop

每个适配器的完整参考文档,包括工具、REST 路由、CLI 命令、设置和记忆驱动程序,均位于文档网站。每个适配器自身的 README 只是简短指引,而非完整手册。要构建新适配器?请参阅社区适配器指南。

MCP 服务器

phpclaw/phpclaw-mcp 通过模型上下文协议暴露现有的 ToolRegistry,因此 Claude Desktop、Claude Code、Cursor 或任何兼容 MCP 的客户端都可以直接调用你的工具;默认防护措施会扫描每次工具调用的参数(仅适用于聊天消息的代码注入、个人身份信息和长度防护,不会应用于工具参数)。无需改动工具本身。

composer require phpclaw/phpclaw-mcp

完整的快速入门、传输层和安全详情:phpclaw.ai/docs/mcp。

安全

每条消息在到达提供商之前,都会先经过默认防护链。ShellTool 仅运行白名单中的命令(默认为 ls、pwd、df、wc、date、uptime、hostname、whoami),匹配时要求完全一致且区分大小写;无论白名单中包含什么,都会首先检查固定且不可覆盖的危险命令阻止列表。HttpTool 先按主机名前缀阻止请求,然后重新验证每个解析后的 IP 地址,从而捕获仅检查主机名会遗漏的 CGNAT 和 DNS 重绑定尝试。FileReadTool 和 FileWriteTool 被限制在已配置的工作区根目录沙箱内,无条件拒绝访问凭据、密钥和安全目录(.git、.ssh、wp-admin 等),默认也拒绝访问 vendor/ 和 node_modules/。

完整的防护措施参考、确切的 ShellTool 阻止列表以及 SSRF/沙箱实现详情:phpclaw.ai/docs/security。发现漏洞?请参阅 SECURITY.md,不要创建公开 issue。

架构

消息 → 防护措施(在 LLM 看到消息前阻止注入和个人身份信息泄露) → 钩子(触发生命周期事件,整个循环中共有 44 个) → 智能体(ReAct 循环:提供商 + 工具 + 记忆 + 技能) → AgentResponse(文本、词元、工具调用、计时)

提供商、工具、记忆、防护措施和技能均可通过注册表插拔;每个适配器都从自身配置或环境变量接入这些组件。完整架构图和设计规则:phpclaw.ai/docs/architecture。

可扩展性

提供五个静态注册表(GuardRegistry、HookRegistry、MemoryRegistry、ProviderRegistry、SkillRegistry),以及每个智能体各自拥有的 ToolRegistry 实例。将带有相应属性(#[Tool]、#[Provider]、#[Memory]、#[Skill]、#[Hook]、#[Guard])的类放入 packages/core/src/<Subsystem>/,然后运行 composer dump-autoload,即可生效。也可以从代码注册:GuardRegistry::register()、HookRegistry::on()、$toolRegistry->register([...])。

涵盖每个子系统并附可运行代码的完整扩展配方:phpclaw.ai/docs。

测试

for pkg in core cloud mcp ; do (cd packages/ $pkg && composer test) ; done

单元测试针对 HTTP 客户端、\Redis 和文件系统使用模拟对象与桩:运行 core、cloud 或 mcp 测试套件均不需要外部网络调用或 API 密钥。完整测试规则(包括如何通过适配器测试核心变更)见贡献指南。

文档

本 README 可帮助你完成安装。其他所有内容,包括架构、完整的提供商/工具/防护措施/钩子/记忆/技能参考、各适配器的工具和 REST 对照表、代码示例、升级与故障排除,均位于:

phpclaw.ai/docs

贡献指南 · 安全政策

要求

PHP:8.1、8.2、8.3、8.4

扩展:ext-curl、ext-json、ext-mbstring(仅限核心;适配器可能需要更多扩展,每个软件包均有说明)

许可证

MIT,采用

……(正文超出本站单页篇幅上限,此处截断;完整表述请见下方原文入口。)

译文由上游机器翻译生成,可能有误;判断请以英文原文为准。

英文原文(来源本站未改写)

0.x

Branches Tags

Go to file

Code Open more actions menu

Latest commit

History

111 Commits

111 Commits

Folders and files

Name Name Last commit message

Last commit date

.github

.github

packages

packages

.editorconfig

.editorconfig

.gitattributes

.gitattributes

.gitignore

.gitignore

LICENSE

LICENSE

Makefile

Makefile

README.md

README.md

composer.json

composer.json

View all files

Repository files navigation

phpclaw
phpclaw
phpclaw
phpclaw
Core Tests
Core Tests
PHP Version
PHP Version
License: MIT
License: MIT
Version
Version
Downloads
Downloads

The universal AI agent engine for PHP.

Tools, memory, security, and a ReAct loop, already built. Zero framework dependencies in core. Any LLM provider.

Documentation · Adapters · Why phpClaw · Install · MCP · Security

phpClaw demo: composer require phpclaw/phpclaw-laravel, then the agent calls real shell tools to check disk usage and clean logs
phpClaw demo: composer require phpclaw/phpclaw-laravel, then the agent calls real shell tools to check disk usage and clean logs

First agent in seconds

composer require phpclaw/phpclaw export ANTHROPICAPIKEY= " sk-ant-... "

$ agent = PhpClaw \Claw:: builder ()-> build (); echo $ agent -> send ( ' What can you help me with? ' )-> text ;

One env var, one builder, one send() . The builder checks ANTHROPICAPIKEY , then OPENAIAPIKEY , GROQAPIKEY , GEMINIAPIKEY , MISTRALAPIKEY , DEEPSEEKAPIKEY , OLLAMA_HOST , in that order, and uses whichever it finds first. No YAML, no agent framework to learn, no vendor lock-in.

Give your agent tools

An agent without tools can only talk. Register the ones your application needs and it starts doing real work:

use PhpClaw \ Claw ; use PhpClaw \ Tools \ ShellTool ; use PhpClaw \ Tools \ HttpTool ; use PhpClaw \ Tools \ FileReadTool ; use PhpClaw \ Tools \ DatabaseQueryTool ; use PhpClaw \ Tools \ CodeSearchTool ;

$ agent = Claw:: builder () -> tools ([ new ShellTool (allowlist: [ ' ls ' , ' df ' , ' tail ' ]), new HttpTool (), new FileReadTool (), new DatabaseQueryTool ( $ pdo ), new CodeSearchTool (), ]) -> build ();

Check disk usage and tail the last 20 lines of the error log Is api.example.com responding right now? Run a read-only SELECT to count today's orders Find every place UserService is used in this codebase

The agent decides which tools to call and in what order, running a ReAct loop (reason, act, observe, repeat) until it has an answer or hits the iteration cap. This works identically whether the tools touch your shell, your database, your HTTP APIs, or your codebase.

Why phpClaw

Every "AI in PHP" tutorial ends the same way: an HTTP client bolted onto a provider API, a hand-rolled tool-call loop, and a prayer that the prompt holds up in production. A generic LLM SDK gives you the API client. phpClaw gives you the agent runtime around it: the loop, the guards, the memory, the framework wiring, already assembled.

phpClaw Generic LLM SDK

Tool-calling loop ReAct, built in You write it

Framework-native adapters 8, idiomatic per framework None

Prompt injection defence 8 default guards + opt-in rate limiting None

Memory abstraction Swappable drivers None

Streaming + tool-calls together Hybrid mode Varies

MCP server bundled Expose any app to Claude Desktop None

Chains and multi-agent graphs Pipeline and Graph : loops, human pause and resume, fan-out You build it

Zero framework deps in core ext-curl , ext-json , ext-mbstring , done Depends

Core license MIT, nothing gated Varies

Not trying to be everything. phpClaw isn't a RAG framework: there are no embeddings or vector stores. It's built to give an LLM tools, memory and security controls against your real application, and to chain those agents into pipelines and graphs when one call isn't enough.

What phpClaw provides

Agent runtime. A ReAct loop with a hard iteration cap ( maxiterations , default 20), pluggable tools, pluggable memory, and skills the model loads on demand through the loadskill tool, all running inside a single reasoning cycle.

Pipelines and graphs. Pipeline chains steps (prompt template, agent, structured output, your own callables) with retry and fallback. Graph runs nodes that loop, branch, pause for a human, resume in another process, and fan out to branches that run inline or are drained by workers from cron, a queue or the CLI. See Pipelines and Graphs .

Provider flexibility. 7 providers auto-detected from environment variables: Anthropic, OpenAI, Groq, Gemini, Mistral, DeepSeek, Ollama. A custom OpenAI-compatible endpoint is also supported, opt-in via PHPCLAW_PROVIDER=custom . Switch providers with ->provider() and ->model() , no code changes elsewhere.

Production controls. 8 security guards on by default (prompt injection, PII, code injection, Unicode, homoglyph, role-switch, destructive SQL, message length), plus rate limiting available as an opt-in guard.Tool results are sanitised unconditionally by ToolOutputGuard , which sits outside the guard registry, and LLM output sanitisation is on by default and can be disabled with ->sanitiseOutput(false) .ShellTool is allowlist-only with a hard-coded command blocklist that can't be overridden.HttpTool validates resolved IPs, not just hostnames, closing the DNS-rebinding gap a prefix blocklist alone would miss.

FileReadTool / FileWriteTool are workspace-sandboxed and refuse sensitive paths and extensions.

Developer experience. Token-by-token streaming, prompt caching (cached input tokens billed at Anthropic's discounted cache-read rate, see Anthropic's pricing for the exact figure), and extended thinking (Claude's reasoning chain exposed on $response->thinking ).

Ecosystem. 8 framework and CMS adapters, an MCP server for exposing your tools to Claude Desktop and Claude Code, and an optional cloud transport for a hosted, continuously-updated prompt-scan guard.

Framework & CMS adapters

Each adapter wires phpClaw into its host's own idioms: Eloquent for Laravel, Doctrine for Symfony, WP-CLI for WordPress, Drush for Drupal, and so on. Every adapter ships an admin chat or CLI and the same 3-table memory schema underneath.

Platform Package Install Versions

Laravel phpclaw/phpclaw-laravel Composer 10, 11, 12, 13

Symfony phpclaw/phpclaw-symfony Composer 6.4, 7.x, 8.x

Drupal phpclaw/phpclaw-drupal Composer 10, 11

Magento / Adobe Commerce phpclaw/phpclaw-magento Composer 2.4.x

WordPress + WooCommerce -- ZIP upload 6.2+

Joomla -- ZIP upload 4, 5, 6

OpenCart -- ZIP upload 3.x, 4.x

PrestaShop -- ZIP upload 8.x, 9.x

CMS adapters ship as ZIP downloads from Releases , not Composer, because that's how their host platforms install extensions.

php artisan phpclaw " deploy staging and notify #ops " # Laravel bin/console phpclaw " check all database connections " # Symfony drush phpclaw:run " list recently-active users " # Drupal bin/magento phpclaw:run " check order-queue status " # Magento wp phpclaw send " summarise today's posts " # WordPress php cli/joomla.php phpclaw " list recent articles " # Joomla php cli/phpclaw.php send " check low stock products " # OpenCart php modules/phpclaw/cli/phpclaw.php send " check stock levels " # PrestaShop

Full per-adapter reference (tools, REST routes, CLI commands, settings, memory drivers) lives on the doc site . Each adapter's own README is a short pointer, not a manual. Building a new one? See the community adapter guides .

MCP Server

phpclaw/phpclaw-mcp exposes your existing ToolRegistry over the Model Context Protocol, so Claude Desktop , Claude Code , Cursor, or any MCP-compatible client can call your tools directly, with the default guards scanning every tool call's arguments (the prompt-only code-injection, PII and length guards apply to chat messages, not tool arguments). No changes to the tools themselves.

composer require phpclaw/phpclaw-mcp

Full quick start, transport, and security details: phpclaw.ai/docs/mcp .

Security

Every message runs through the default guard chain before it reaches the provider.ShellTool runs only commands on its allowlist (default ls , pwd , df , wc , date , uptime , hostname , whoami ), matched exactly and case-sensitively;a fixed, non-overridable blocklist of dangerous commands is checked first regardless of what's allowlisted.HttpTool blocks requests by hostname prefix, then re-validates every resolved IP address, catching CGNAT and DNS-rebinding attempts that hostname checks alone would miss.

FileReadTool and FileWriteTool are sandboxed to a configured workspace root and refuse credentials, keys and security directories ( .git , .ssh , wp-admin , ...) unconditionally, and vendor/ and node_modules/ by default.

Full guard reference, the exact ShellTool blocklist, and the SSRF/sandbox implementation details: phpclaw.ai/docs/security . Found a vulnerability? See SECURITY.md , do not open a public issue.

Architecture

Message → Guards (blocks injection/PII before the LLM sees it) → Hooks (lifecycle events fire, 44 across the loop) → Agent (ReAct loop: provider + tools + memory + skills) → AgentResponse (text, tokens, tool calls, timing)

Providers, tools, memory, guards, and skills are all pluggable through registries; every adapter wires them from its own config or environment. Full architecture diagram and design rules: phpclaw.ai/docs/architecture .

Extensibility

Five static registries ( GuardRegistry , HookRegistry , MemoryRegistry , ProviderRegistry , SkillRegistry ) plus the per-agent ToolRegistry instance. Drop a class in packages/core/src/<Subsystem>/ with the matching attribute ( #[Tool] , #[Provider] , #[Memory] , #[Skill] , #[Hook] , #[Guard] ), run composer dump-autoload , it's live. Or register from code: GuardRegistry::register() , HookRegistry::on() , $toolRegistry->register([...]) .

Full extension recipes with working code for every subsystem: phpclaw.ai/docs .

Testing

for pkg in core cloud mcp ; do (cd packages/ $pkg && composer test) ; done

Unit tests use mocks and stubs for HTTP clients, \Redis , and the filesystem: no external network calls and no API keys are needed to run the suite for core, cloud, or mcp. The full testing rules, including how to test a core change through an adapter, are in the contributing guide .

Documentation

This README gets you installed. Everything else, architecture, the full provider/tool/guard/hook/memory/skill reference, per-adapter tool and REST tables, code examples, upgrading, troubleshooting, lives at:

phpclaw.ai/docs

Contributing guide · Security policy

Requirements

PHP: 8.1, 8.2, 8.3, 8.4

Extensions: ext-curl , ext-json , ext-mbstring (core only; adapters may need more, documented per-package)

License

MIT , built wi

... (truncated at the site's per-page length limit; see the source link below for the full text.)

出处https://github.com/phpclaw-php/phpclaw-monorepo抓取日期 · 采集源 Hacker News

03 / EVIDENCE GAPS

这条还缺什么证据?

下面每条都由本条已有字段推出(等级、理由、商业模式、来源次数、是否演示), 本站不生成推测性结论;通用验证方法放在方法论页。

  • 可核验的收入或付费证据查官网定价页与付费口径;第三方数据源(如 GetLatka)只作旁证,需标注来源与时点。
  • 商业模式未定确认按席位/按用量/授权还是开源托管版收费;开源项目另查 LICENSE 与是否存在付费版。
  • 只有单一来源找一手站点或其他渠道是否重复出现同一产品;社区热帖数量不等于商业进展。

通用验证清单(谁有这个问题/谁愿意付费/一个人能交付哪一小步)见我们的筛选方法。

04 / SIGNAL HISTORY

发现时间线