Skip to content

AI Agents. Native to PHP.

One Composer package gives any PHP app an AI agent with tools, memory and input guards. Switch between Anthropic, OpenAI, Gemini and OpenAI-compatible providers with an environment variable.

Install the core package. No framework is required:

Terminal window
composer require phpclaw/phpclaw

Set one API key, such as ANTHROPIC_API_KEY or OPENAI_API_KEY, then give the agent a tool and ask:

use PhpClaw\Claw;
use PhpClaw\Tools\DatabaseQueryTool;
$agent = Claw::builder()
->tools([new DatabaseQueryTool($pdo)])
->build();
echo $agent->send('How many orders came in today?')->text;

The database tool accepts only read-only queries. Without a tool, the agent can answer only from what the model already knows.

Using Laravel, Symfony, WordPress or another platform? Each adapter wires phpClaw into it. See Getting Started.