Download the PHP package goldenpathdigital/laravel-claude without Composer
On this page you can find all versions of the php package goldenpathdigital/laravel-claude. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-claude
Laravel Claude
A Laravel wrapper for the official Anthropic PHP SDK with first-class MCP connector support.
Table of Contents
- Features
- Requirements
- Installation
- Usage
- Direct SDK Access
- Models API
- Message Batches API
- Files API
- Token Counting
- Cost Estimation
- Fluent Conversation Builder
- Multi-turn Conversations
- Image Support
- PDF Documents
- Advanced Parameters
- Streaming
- Tools
- MCP Connector
- Extended Thinking
- Prompt Caching
- Structured Outputs
- Testing
- Available Assertions
- Faking Tool Use Responses
- Configuration
- Queue Integration
- License
Features
- Official SDK — Wraps
anthropic-ai/sdk, not a custom HTTP implementation - Laravel Native — Facades, config, service provider, auto-discovery
- Fluent API — Chainable conversation builder with image support
- Full API Coverage — Messages, Models, Batches, Files, Token Counting
- Tool System — Define tools with fluent builder and automatic execution loop
- MCP Connector — First Laravel package with MCP client support
- Streaming — Real-time streaming with Laravel events
- Extended Thinking — Access Claude's reasoning process with budget tokens
- Prompt Caching — Reduce costs with cached system prompts
- Structured Outputs — JSON schema validation for responses
- Queue Integration — Process conversations in background jobs with retry handling
- Testing Utilities —
Claude::fake()with assertion helpers
Requirements
- PHP 8.2+
- Laravel 10, 11, or 12
Installation
Publish the config file:
Add your API key to .env:
Usage
Direct SDK Access
Models API
List and retrieve available Claude models:
Message Batches API
Process multiple messages in batch for high-throughput workloads:
Files API
Manage files uploaded to the Anthropic API:
Token Counting
Count tokens before sending a request:
Cost Estimation
Estimate API costs based on token usage:
Fluent Conversation Builder
Multi-turn Conversations
Image Support
Send images for Claude to analyze:
PDF Documents
Analyze PDF documents:
Advanced Parameters
Fine-tune model behavior with additional parameters:
Streaming
Stream responses in real-time with callback support:
Or listen for Laravel events:
Tools
Define tools with a fluent builder and let Claude execute them automatically:
MCP Connector
Connect to remote MCP servers via Anthropic's connector API:
Or use pre-configured servers from config:
Extended Thinking
Enable Claude's reasoning process for complex problems:
Prompt Caching
Reduce costs by caching large system prompts:
Structured Outputs
Get responses validated against a JSON schema:
Testing
Use Claude::fake() to mock responses in your tests:
Available Assertions
Faking Tool Use Responses
Configuration
Queue Integration
Process conversations in background jobs with automatic retry handling:
The job includes:
- Automatic retries: 3 attempts with 10 second backoff
- Callback pattern: Handle success/failure in dedicated classes
- Context passing: Pass arbitrary data to the callback
- Full feature support: MCP servers, extended thinking, caching, structured outputs
Note: Tools with custom handlers (closures) cannot be serialized for queue jobs. Use MCP servers or basic conversations for queued processing.
Running Tests
Code Style
License
MIT License. See LICENSE for details.
All versions of laravel-claude with dependencies
anthropic-ai/sdk Version ^0.4
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/contracts Version ^10.0|^11.0|^12.0