phpClaw adapter for Laravel. Add AI agents to any Laravel app with a single composer require.
phpclaw/phpclaw-laravel is a Laravel package for phpclaw adapter for laravel. add ai agents to any laravel app with a single composer require..
It currently has 6 GitHub stars and 35 downloads on Packagist (latest version v0.1.1).
Install it with composer require phpclaw/phpclaw-laravel.
Discover more Laravel packages by phpclaw
or browse all Laravel packages to compare alternatives.
Last updated
This is a read-only mirror, auto-published from
phpclaw-monorepo. Please open issues and pull requests there, not here.
An agent engine with tools, guards and memory, native to Artisan, DI and queues. Laravel 10 to 13, PHP 8.1+.
Most "AI in Laravel" setups mean gluing an HTTP client to your app and hoping the prompt holds up. phpClaw is a real dependency: autowired via the container, driven by Artisan, backed by your database, with tools that actually query your application 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.
> How many users signed up this week?
> Show me the last 20 failed jobs
> What's in the cache under the "settings" key?
> List all registered API routes
> Summarise today's error log
The agent from your terminal, scriptable and CI-friendly:
php artisan phpclaw "how many users signed up this week?"
php artisan phpclaw "check queue health" --stream
Autowired via the container. Inject ClawInterface anywhere:
use PhpClaw\Contracts\ClawInterface;
class DashboardController
{
public function __construct(private readonly ClawInterface $phpclaw) {}
public function summary()
{
return $this->phpclaw->send('Summarise this week\'s signups.')->text;
}
}
Enabled by default (phpclaw.api.enabled, from PHPCLAW_API_ENABLED, which defaults to true); set it to false to close both routes. Two routes, under a configurable prefix (default /phpclaw):
POST /phpclaw/send synchronous agent run
POST /phpclaw/chat/stream streamed response
Both require an authenticated user: every conversation is stored against auth()->id(), and a
caller only ever reaches their own conversations. Point phpclaw.api.middleware at the guard your
app authenticates API callers with. Two things grant cross-user access, and both are off by
default: the phpclaw.manage-all Gate ability, which denies unless your app defines it, and the
PHPCLAW_ADMIN_IDS env list, whose user IDs bypass the Gate entirely. The API also needs a memory
driver that keeps conversations per user (database, the default); with any other driver both
routes answer 503.
composer require phpclaw/phpclaw-laravel
Set one provider key in .env (e.g. ANTHROPIC_API_KEY=sk-ant-…), then run your first agent:
php artisan phpclaw "how many users signed up this week?"
Full setup, configuration, and provider options are documented at phpclaw.ai/docs/adapters/laravel.
✅ Native Artisan CLI: phpclaw, phpclaw:mcp-server, phpclaw:about, phpclaw:guide, phpclaw:stats, phpclaw:jobs:list, phpclaw:jobs:status
✅ Database-backed memory: conversation + key-value drivers via the query builder, plus a cache-store driver
✅ 6 Laravel-native tools: database (read-only SELECT), log tail, route list, config read, cache inspect, queue status. Opt-in: list their classes in config('phpclaw.tools'), the same way as shell, HTTP, file write and file edit
✅ Telescope integration: every agent run, tool call, and guard block recorded for local debugging (auto-detected, off if Telescope isn't installed)
✅ REST API: on by default behind your API middleware, two endpoints: send and chat/stream. Set PHPCLAW_API_ENABLED=false to close them
✅ 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
Laravel → phpClaw Laravel adapter (PhpClawServiceProvider) → phpClaw agent runtime → your configured AI provider
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/laravel
Contributions are welcome. See the contributing guide.
Please review our security policy for reporting vulnerabilities.
MIT. See LICENSE. Part of the phpClaw project.
Laravel is a trademark of Laravel Holdings Inc. phpClaw is an independent open-source project and is not affiliated with or endorsed by Laravel Holdings Inc.