phpClaw Brings an Open AI Agent Runtime to PHP | Zeniteq
Loading
Loading article
Zeniteq is now available on mobile for iPhone, iPad and Apple Watch.Download nowLearn more
phpClaw Brings an Open AI Agent Runtime to PHP
The MIT-licensed project bundles tool loops, memory and security controls for PHP applications, while deliberately leaving embeddings and vector stores out of scope.
phpClaw is a new MIT-licensed AI agent runtime for PHP that bundles a ReAct tool-calling loop, pluggable memory, seven model providers, and adapters for eight frameworks including Laravel, Symfony, WordPress, and Drupal.
The project requires PHP 8.1 or later and defaults to a 20-iteration loop cap. It claims eight enabled-by-default security guards covering prompt injection, PII, and destructive SQL, plus separate controls for shell, HTTP, and file tools. Embeddings and vector stores are explicitly out of scope.
phpClaw packages an AI agent runtime for PHP, with a built-in tool-calling loop, swappable memory, seven model providers and adapters for eight frameworks and content management systems. Its GitHub README lists eight security guards enabled by default, alongside separate controls for shell commands, HTTP requests and file access.
The author introduced the project on Show HN. Daily Launch’s timeline dates that post to October 29, 2026, and lists October 30 as its first ranking date. The opened Hacker News page displays only a relative age.
For PHP teams, the useful distinction is between calling a model and operating an agent. An API client can send a prompt and receive text. An agent runtime also has to manage tool requests, return results to the model, repeat that process and decide when to stop. phpClaw assembles those pieces inside the PHP application stack.
Its most consequential design choice is the boundary it draws: tools, memory and execution controls are included; a retrieval-augmented generation system is not.
What phpClaw Runs Inside Your Application
phpClaw implements a ReAct loop: reason, act, observe and repeat. The model selects a registered tool, the runtime executes it, and the result becomes input for the next step. According to the project documentation, the loop continues until the agent produces an answer or reaches its iteration cap, which defaults to 20.
The supplied tools cover operations including shell commands, HTTP requests, file access, database queries and code search. The README illustrates tasks such as checking disk usage, inspecting an error log, counting orders with a read-only database query and finding references to a service in a codebase.
Those examples explain why the runtime matters. A question about today’s orders requires an application data source and permission to query it. The language model alone cannot supply that access.
The documented minimal setup starts with Composer and a provider credential:
The shell commands install the package and set a credential in that shell environment. The PHP example builds an agent, sends a message and prints its text response. It does not register application tools or demonstrate a production deployment.
The author specifies PHP 8.1 or later in the Show HN introduction. The README describes a framework-independent core and lists the ext-curl, ext-json and ext-mbstring extensions.
Memory, Skills and Longer Workflows
phpClaw also documents pluggable memory and skills that the model loads on demand through a load_skill tool. A memory abstraction allows teams to change the storage driver without rebuilding the agent loop, although storage retention and access policies still need attention in the chosen implementation.
For workflows beyond one agent interaction, the project supplies two additional structures:
Pipeline chains prompt templates, agents, structured output and application callables, with retry and fallback support.
Graph supports branching, loops, human pauses, resumption in another process and fan-out work.
Graph branches can run inline or be handled by workers through cron, a queue or the command line. For PHP applications serving web requests, that matters: a lengthy agent workflow need not remain attached to one browser request. Teams would still need to arrange the worker infrastructure.
I would treat the 20-iteration default as a useful stop condition, not a spending budget. It limits loop iterations; it does not specify a maximum token bill or the cost of an individual tool operation.
Framework Adapters and Provider Selection
phpClaw lists adapters for Laravel, Symfony, WordPress, Drupal, Magento, Joomla, OpenCart and PrestaShop. The core has no framework dependency, so the documented architecture also leaves room for standalone PHP applications. These are project-listed integrations, not a comparison of adapter completeness or maturity. (GitHub README)
The provider builder checks environment variables in a fixed order and selects the first one it finds:
Priority
Provider
Environment Variable
1
Anthropic
ANTHROPIC_API_KEY
2
OpenAI
OPENAI_API_KEY
3
Groq
GROQ_API_KEY
4
Gemini
GEMINI_API_KEY
5
Mistral
MISTRAL_API_KEY
6
DeepSeek
DEEPSEEK_API_KEY
7
Ollama
OLLAMA_HOST
The runtime also supports a custom OpenAI-compatible endpoint, explicitly selected with PHPCLAW_PROVIDER=custom. The README documents ->provider and ->model for choosing a provider and model in application code.
That automatic selection is convenient for a small example, but the precedence deserves attention in shared environments. If both Anthropic and OpenAI credentials are present, the documented order selects Anthropic first. I’d make provider and model selection explicit in deployed applications so an unrelated environment change cannot silently alter the intended choice.
A common runtime interface also should not be read as identical capabilities across every backend. The README specifically associates prompt caching and extended thinking with Anthropic or Claude. Teams relying on those features should check their selected provider’s support.
phpClaw additionally bundles an MCP server for exposing application tools to Claude Desktop and Claude Code. That extends the same tool-building work to external AI clients, making tool permissions important beyond the application’s own chat interface.
Eight Default Guards Are One Part of the Boundary
The README lists these eight enabled-by-default guard categories:
Prompt injection
Personally identifiable information, or PII
Code injection
Unicode
Homoglyph
Role-switch
Destructive SQL
Message length
The overview names the guard categories, but it does not provide effectiveness measurements or enough detail to judge every detection rule and threshold. The supplied evidence includes no independent security audit. These are documented project controls, not independently verified protection results.
The more useful architectural detail is that phpClaw describes controls at several different boundaries.
Tool Results and Model Output Have Separate Controls
The project says ToolOutputGuard sanitizes tool results unconditionally and sits outside the guard registry. That distinction matters because data returned by a tool can itself contain instructions: a fetched page, log entry or database field may carry text intended to redirect an agent.
The README separately says model-output sanitization is enabled by default and can be disabled with ->sanitiseOutput(false). Rate limiting is another separate control, but it is opt-in, not one of the eight defaults.
This separation is worth preserving when evaluating the project. Input checks, tool-result processing and output handling address different points in an agent’s execution path. Counting them all as a single prompt filter would obscure how the runtime is designed.
Shell, HTTP and File Tools Restrict Their Own Reach
The documented tool controls go beyond examining messages:
Tool
Documented Restriction
ShellTool
Requires a command allowlist and retains a hard-coded blocklist that cannot be overridden
HttpTool
Validates resolved IP addresses, addressing a DNS-rebinding gap left by hostname-only checks
FileReadTool and FileWriteTool
Restrict access to a workspace and refuse sensitive paths and extensions
These restrictions matter because a valid-looking model request can still ask for a dangerous operation.
For HTTP access, checking the resolved address helps control where a request actually goes. A permitted-looking hostname can otherwise resolve to an address the application should not contact. The README explicitly presents its IP validation as protection against this DNS-rebinding issue.
For shell access, an allowlist narrows which commands the model can request, while the non-overridable blocklist keeps another boundary in place. For files, workspace restrictions limit the portion of the filesystem exposed to the agent.
My view is that these execution boundaries are the stronger reason to inspect phpClaw. Message scanning can be useful, but restricting reachable resources directly reduces what an agent can attempt. Application permissions still need to match that intent: a database account with read-only privileges provides a concrete boundary for a reporting agent.
Why phpClaw Leaves RAG Out
phpClaw explicitly excludes embeddings and vector stores from its scope. Its focus is on giving models tools, memory and security controls, then composing agents into larger workflows. (GitHub README)
That is a meaningful distinction for teams choosing between AI products and libraries. A typical retrieval-augmented generation setup prepares documents, retrieves relevant passages and supplies them as context to a model. Embeddings and vector stores often support that retrieval process.
An agent runtime solves a different coordination problem: which tool to call, how to handle its result and whether another action is needed.
Consider two PHP application features:
An order-support assistant needs live order status, inventory and customer-permitted account data. Application tools are a natural way to access those records.
A documentation assistant needs to find relevant passages across a collection of manuals. phpClaw does not supply the embedding and vector-store components for that system.
A team could connect an existing search or retrieval service through a tool. That is an architectural option, not a bundled phpClaw retrieval feature.
Memory also should not be mistaken for a searchable knowledge base. Retaining interaction state and retrieving authoritative document passages serve different purposes.
I think the narrower scope is sensible for PHP teams whose valuable data already sits behind application services. It keeps the runtime focused. Teams starting with a large document-search requirement, however, should budget for a separate retrieval layer instead of expecting the memory abstraction to provide one.
A Practical First Evaluation
A small, read-only workflow would provide a clearer evaluation than immediately granting shell, file-write and broad database access.
For an order-reporting agent, that could mean exposing one narrowly scoped reporting tool, using read-only database credentials, explicitly selecting the model, and choosing iteration and rate limits appropriate to the task. The evaluation should examine failed tool calls and hostile tool results as well as successful answers.
That approach follows directly from phpClaw’s documented design: models choose actions, tools define their reach, and guards operate around those interactions. The key adoption question is whether a team can express its application permissions cleanly within that structure.
Frequently Asked Questions
4 questions
1
What Is phpClaw?
phpClaw is an MIT-licensed PHP agent runtime that bundles a ReAct loop, tools, pluggable memory, security guards and framework adapters.
2
Which PHP Frameworks Does It Support?
The project lists Laravel, Symfony, WordPress, Drupal, Magento, Joomla, OpenCart and PrestaShop adapters. Its core has no framework dependency.
3
Does phpClaw Include RAG Features?
No. It deliberately excludes embeddings and vector stores. Applications needing document retrieval must supply that layer separately.
4
Are All Security Controls Enabled by Default?
The README lists eight default guards, unconditional tool-result sanitization and default model-output sanitization. Rate limiting is opt-in. These documented controls are not a substitute for narrowly scoped application permissions.