phpClaw
Open-source PHP AI agent engine with tools, memory, security guards and a ReAct loop, with adapters for Laravel, Symfony, WordPress and other PHP platforms.
At a Glance
Self-hosted phpClaw core engine and adapters under the MIT license; no usage fees or per-token markup. LLM provider API costs are external.
Engagement
Available On
Listed Nov 2026
About phpClaw
phpClaw is an open-source, MIT-licensed AI agent engine for PHP 8.1+ that adds a tool-calling agent to an existing PHP application through a Composer package or an uploaded CMS plugin. It runs on your own server and sends prompts only to the LLM provider you choose. It ships eight first-party adapters for Laravel, Symfony, WordPress, Drupal, Joomla, Magento, PrestaShop and OpenCart, and also runs in plain PHP.
What It Is
phpClaw is an agent runtime for PHP developers. A single Claw::builder()->build()->send() call runs a ReAct loop (reason, act, observe) in which the model can call registered tools, read their results and continue until it has an answer or reaches the iteration cap. The core package has no framework dependencies, needing only PHP 8.1+ with curl, json and mbstring. Responses return the text, provider, model and token counts.
Agent Building Blocks
Any PHP class implementing a tool interface can be exposed to the model. Built-in tools include code search, file read and write, allowlisted shell, HTTP and read-only database queries. Skills written in Markdown or arrays are loaded on demand by the model. Pipelines chain prompt, agent and structured-output steps, and graphs run multi-agent workflows with loops, branching, and human pause and resume. Structured output validates replies against a JSON Schema and retries failures. Mutating tools can require human approval before running.
Providers, Memory and Security
Providers are auto-detected from environment variables: Anthropic, OpenAI, Groq, Gemini, Mistral, DeepSeek and Ollama, plus a custom OpenAI-compatible endpoint, with optional fallback providers. Memory drivers include file, array, Redis, a namespace router and framework-native stores. Eight guards run by default, covering prompt injection, code injection, destructive SQL, role switching, homoglyphs, unicode, message length and PII. Shell access is allowlist-only, and file tools are sandboxed to a workspace. The docs also describe 54 lifecycle events for logging and metrics.
MCP and Setup
The phpclaw/phpclaw-mcp package exposes a tool registry as a Model Context Protocol server over stdio or Streamable HTTP, so clients such as Claude Desktop, Claude Code, Cursor, Windsurf and Zed can call the tools. Setup is typically a Composer require, one provider API key and a framework-native CLI command such as php artisan phpclaw. The project's README states that it is not a RAG framework and has no embeddings or vector stores. The maintainers also offer custom tool and adapter development through an enterprise page.
Community Discussions
Be the first to start a conversation about phpClaw
Share your experience with phpClaw, ask questions, or help others learn from your insights.
Pricing
Open Source (MIT)
Self-hosted phpClaw core engine and adapters under the MIT license; no usage fees or per-token markup. LLM provider API costs are external.
- MIT licensed, nothing gated
- No usage fees, no per-token markup
- Self-hosted; prompts go only to the provider you choose
- 8 framework/CMS adapters
- 8 default security guards
Enterprise
Custom AI tools and integrations built for your stack by the phpClaw maintainers; fixed proposal after discovery call.
- Custom AI tools
- Plugins and modules extending phpClaw
- Security and access review
- Deployment and rollout
- Priority support and maintenance
Capabilities
Key Features
- ReAct agent loop with iteration cap
- Custom tools via a simple interface
- Built-in tools: code search, file read/write/edit, shell allowlist, HTTP, read-only database query, zip packager
- Eight default security guards including prompt-injection and PII detection
- Pluggable memory drivers (file, array, Redis, router, framework-native)
- Pipelines and graphs for chains and multi-agent workflows
- Human approval gates for mutating tools
- Structured output with JSON Schema validation and retry
- Markdown and array skills loaded on demand
- Streaming responses
- Provider auto-detection and fallback providers
- 54 lifecycle hook events
- MCP server over stdio and Streamable HTTP
- Eight framework and CMS adapters with native CLI
