Search by

phpclaw / phpclaw-symfony

phpclaw

phpClaw bundle for Symfony. AI agent engine for PHP.

Package info

github.com/phpclaw-php/phpclaw-symfony

Homepage

Issues

Documentation

Type:symfony-bundle

pkg:composer/phpclaw/phpclaw-symfony

Statistics

Installs: 5

Dependents: 0

Suggesters: 0

Stars: 0

v0.1.0 2026-09-23 20:06 UTC

This package is auto-updated.

Last update: 2026-09-23 20:47:20 UTC


README

phpclaw phpclaw

PHP Symfony License Downloads Tests Version

This is a read-only mirror, auto-published from phpclaw-monorepo. Please open issues and pull requests there, not here.

Give your Symfony app an agent, not a chatbot.

phpClaw is the AI layer for Symfony: bundle, console, Doctrine, all native.

Most "AI in Symfony" setups mean gluing an HTTP client to your app and hoping the prompt holds up. phpClaw is a real bundle: autowired as a service, driven by the console, backed by Doctrine, with tools that actually query your database instead of guessing.

Ask it something and it picks a tool, runs it against your live app, and answers with real data. No fine-tuning, no separate service to run.

Just ask

> How many users signed up this week?
> Tail the last 50 lines of the log at warning level
> Summarise today's error log
> What's the total in the orders table this month?

CLI

phpClaw Symfony CLI in action

The agent from your terminal, scriptable and CI-friendly:

bin/console phpclaw "how many users signed up this week?"
bin/console phpclaw "tail the last 50 error-level log lines" --stream

Programmatic use

Autowired via the container. Inject ClawInterface anywhere:

use PhpClaw\Contracts\ClawInterface;

class DashboardController extends AbstractController
{
    public function __construct(private readonly ClawInterface $phpclaw) {}

    public function summary(): JsonResponse
    {
        return $this->json(['summary' => $this->phpclaw->send('Summarise this week\'s signups.')->text]);
    }
}

REST API

phpClaw Symfony REST API response

Declared in config/routes.yaml, prefixed /phpclaw:

POST /phpclaw/send                          synchronous agent run
POST /phpclaw/chat/stream                   streamed response

The REST API needs symfony/security-bundle, which this package only suggests. Install it and put a firewall over /phpclaw, or every call answers 401. That is correct behaviour, not a misconfiguration: every conversation is stored against the acting user identifier, so there has to be one.

Both require an authenticated user: a request without one is rejected with 401. Point security.yaml at whichever firewall protects the /phpclaw prefix. By default any authenticated user reaches the agent and its tools; set require_chat_role: true to demand ROLE_PHPCLAW_CHAT instead. ROLE_PHPCLAW_MANAGE_ALL grants two things together: reading every user's conversations, and the raw read-only SQL tool, which always requires that role.

Installation

composer require phpclaw/phpclaw-symfony

Symfony Flex registers the bundle for you. Copy the config, set a provider key in .env, then run:

bin/console phpclaw "hello"

Full setup, configuration, and provider options are documented at phpclaw.ai/docs/adapters/symfony.

Key features

Native console commands: phpclaw, phpclaw:mcp-server, phpclaw:about, phpclaw:guide, phpclaw:stats, phpclaw:jobs:list, phpclaw:jobs:status

Doctrine-backed memory: conversation + key-value drivers via DBAL, plus a cache-store driver

2 Symfony-native tools: database (read-only SELECT via Doctrine DBAL), log tail (var/log/*.log)

Web Profiler integration: a dedicated data collector panel for every agent run

REST API: routes ship enabled (PHPCLAW_API_ENABLED defaults to true); set it to false and both answer 403. Two endpoints: send and chat/stream

Multiple AI providers: Anthropic, OpenAI, Groq, Gemini, Mistral, DeepSeek, Ollama, and any custom OpenAI-compatible endpoint

Conversation memory: context carries across a session by default

How it fits together

Symfony → phpClaw Symfony bundle (PhpClawBundle) → phpClaw agent runtime → your configured AI provider

Documentation

This README gets you installed. Everything else (configuration, providers, memory, skills, Cloud, the full tool reference, REST API, CLI, code examples, upgrading, troubleshooting) lives at:

phpclaw.ai/docs/adapters/symfony

Contributing

Contributions are welcome. See the contributing guide.

Security

Please review our security policy for reporting vulnerabilities.

License

MIT. See LICENSE. Part of the phpClaw project.

Symfony is a trademark of Symfony SAS. phpClaw is an independent open-source project and is not affiliated with or endorsed by Symfony SAS.