The universal AI agent engine for PHP. Tools, memory, security, and a ReAct loop, already built. Zero framework dependencies in core.
Any LLM provider. One env var, one builder, one send(). The builder checks ANTHROPIC_API_KEY, then OPENAI_API_KEY, GROQ_API_KEY, GEMINI_API_KEY, MISTRAL_API_KEY, DEEPSEEK_API_KEY, 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: Shell, HTTP, File Read, Database Query, and Code Search. The agent decides which tools to call and in what order, running a ReAct loop 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 php Claw: 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. php Claw gives you the agent runtime around it: the loop, the guards, the memory, the framework wiring, already assembled.
Not trying to be everything. php Claw 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. 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. 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. 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.
Agent runtime: A ReAct loop with a hard iteration cap (max_iterations, default 20), pluggable tools, pluggable memory, and skills the model loads on demand through the load_skill tool, all running inside a single reasoning cycle. Core license: MIT, nothing gated. Zero framework deps in core: ext-curl, ext-json, ext-mbstring, done.
Source: Hacker News · Summarized by HeadlinesBriefing