Anthropic Laravel skill
Anthropic Laravel puts the Claude API behind a Laravel facade and ships a Laravel Boost skill so agents write code for the package
- 74 ★ on the repository
- Last commit
- MIT
Extended access
Why this level
- The package calls the paid Anthropic API with your key, and spend caps are set in the application
- The usage ledger writes request and user data to a database table
Install
- Works in
In your terminal, with SkillFoxx CLI
npx skillfoxx add skills/anthropic-laravelDetects the agents on your machine, shows the access level and pins the version.
Other ways to install
Access and checks
How we reviewExtended accessThe tool runs code or makes network calls and only reads external data.
- The package calls the paid Anthropic API with your key, and spend caps are set in the application
- The usage ledger writes request and user data to a database table
This is third-party code. Review the repository files before installing.
What it does
The package installs through Composer and puts the Anthropic API behind the `Anthropic::` facade: `messages()`, `models()`, `batches()`, `files()`. It includes what provider-neutral packages leave out: Message Batches, token counting, rate-limit headers on every response and refusal fallback. It runs on the community Anthropic PHP SDK and sits beside `laravel/ai`. There are Laravel-native pieces. `Anthropic::batch($requests)->then(...)->dispatch()` sends a batch at half the price and queues a polling job. Named connections and tenant keys use `Anthropic::connection('support')` and `Anthropic::withApiKey($key)`. A usage ledger writes tokens to a table when `ANTHROPIC_LEDGER=true`, and `Anthropic::budget(...)->perDay(200_000)->enforce()` caps a user's spend. Tests get `Anthropic::fake()`, queues get the `ThrottlesAnthropic` middleware, and `php artisan anthropic:doctor` checks the key, queues and fallback models. The repository holds Laravel Boost resources: a guidelines file and an `anthropic-laravel` skill. Boost picks them up from the installed package, and the agent gets facade usage rules with no separate install. A section also covers using the package with Context7.
Who it is for. Laravel developers who call Claude from an app and want an agent in Claude Code or Cursor to know the package API and write code with `Anthropic::`.
Good fit when
- A Laravel project needs to call Claude with streaming straight to the browser
- A set of jobs should go through Message Batches with results handled in an event listener
- Each tenant needs its own Anthropic key and a daily token cap
- Application tests must not hit the network: Claude responses are swapped with `Anthropic::fake()`
Not a fit when
- The project is not on Laravel: use Anthropic PHP, the framework-agnostic package
- You need a provider-neutral layer over several models: `laravel/ai` covers that
- The application runs on PHP older than 8.2
Example request
Add mozex/anthropic-laravel, set up a support connection and write a route that streams a Claude reply to the browserLimitations
- It needs PHP 8.2 or newer and an `ANTHROPIC_API_KEY` from the Anthropic Console. API requests are paid.
- The package is built on the community Anthropic PHP SDK, with no official SDK underneath.
- The Anthropic API is not directly reachable from Russia, and access to it is outside the package's scope.
- Laravel Boost picks up the agent skill; without it the rules have to be wired in by hand: the skill file is `resources/boost/skills/anthropic-laravel/SKILL.md`.
- The usage ledger and budgets need a database table that receives the tokens.
How to disable. Run composer remove mozex/anthropic-laravel and delete `config/anthropic.php` and the `ANTHROPIC_*` variables from `.env`. If Laravel Boost picked up the skill, it disappears with the package at the next resource refresh.
FAQ
How do I install Anthropic Laravel?
Run `composer require mozex/anthropic-laravel`, then `php artisan anthropic:install`: it publishes `config/anthropic.php` and adds `ANTHROPIC_API_KEY=` to `.env`. PHP 8.2 or newer is required.
How do I wire the skill into Claude Code?
Through Laravel Boost: its resources live in the package's `resources/boost/` and are picked up from the installed dependency. By hand you can take `resources/boost/skills/anthropic-laravel/SKILL.md` from the repository.
How is it different from laravel/ai?
`laravel/ai` is provider-neutral, while this package adds Claude specifics: Message Batches, token counting, rate limits in responses, refusal fallback. Both can run in one project.
How do I cap token spend per user?
Enable the ledger with `ANTHROPIC_LEDGER=true` and set a budget: `Anthropic::budget('user:'.$id)->perDay(200_000)->enforce()`, or attach the `anthropic.budget` route middleware.
How do I test code that calls Claude?
Swap the client with `Anthropic::fake([...])`, queue responses and check requests with `Anthropic::assertSent(...)`. No network is used.
Discussion
No questions or reviews yet.
Related
SkillsLaravel's official MCP server, guidelines and skills: the agent sees the DB schema, logs and package versions and searches ecosystem docs
Skills for Laravel Boost and the Neuron AI package: an agent writes PHP AI agents, chat memory, evaluation and frontend glue
Laravel API Architecture Skill
Laravel API Production-Ready Architecture Skill
A skill that keeps an agent within a layered Laravel API architecture: JSON:API v1.1, strict types, PHPStan level 8 and tests
Artisan commands for Laravel that build Eloquent models and migrations from a DBML schema and carry schema edits into new ones
Four skills with Spatie's standards for Laravel, PHP, JavaScript, git and security, installed via Laravel Boost or skills.sh
Laravel Agent Skills
laravel-agent-skills
Laravel's official skill collection for Claude Code and Cursor: plugins for Laravel, Laravel Cloud and Nightwatch
Comparison with similar tools
Cards that share the main search query, and how they differ.
| Tool | Official | Authentication | Repository stars | Main difference |
|---|---|---|---|---|
| Anthropic Laravel (this card) | no | 74 | ||
| Laravel Boost | yes | not required | 3,690 | the Laravel Boost base, while this offers a skill and package built for the Claude API |
| Laravel Agent Skills | yes | 737 | general Laravel skills with no Claude API client for the app |
README in short
The README presents the package as the Claude companion for Laravel: a facade over the Anthropic API with what neutral packages lack. A table of contents leads to documentation on messages, streaming, tools, batches, files, the ledger and budgets. A Why This Package block lists the facade, fake, batches, connections, events and observability, the usage ledger, queue middleware and the doctor command. A two-command install and a sample request finish the page.