Download the PHP package claude-php/claude-php-sdk-laravel without Composer
On this page you can find all versions of the php package claude-php/claude-php-sdk-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download claude-php/claude-php-sdk-laravel
More information about claude-php/claude-php-sdk-laravel
Files in claude-php/claude-php-sdk-laravel
Package claude-php-sdk-laravel
Short Description Laravel integration for the Claude PHP SDK - Anthropic Claude API
License MIT
Homepage https://github.com/claude-php/Claude-PHP-SDK-Laravel
Informations about the package claude-php-sdk-laravel
Claude PHP SDK for Laravel
The unofficial Laravel integration for the Claude PHP SDK, providing seamless access to Anthropic's Claude API in your Laravel applications.
If this saves you time, a star on GitHub helps other Laravel developers find it.
Requirements
- PHP 8.2+
- Laravel 11.x or 12.x
Installation
Install the package via Composer:
The package will automatically register the service provider and facade.
Configuration
Publish the configuration file:
Add your Anthropic API key to your .env file:
Available Configuration Options
| Option | Environment Variable | Default | Description |
|---|---|---|---|
api_key |
ANTHROPIC_API_KEY |
null |
Your Anthropic API key |
base_url |
ANTHROPIC_BASE_URL |
https://api.anthropic.com/v1 |
API base URL |
timeout |
ANTHROPIC_TIMEOUT |
30.0 |
Request timeout in seconds |
max_retries |
ANTHROPIC_MAX_RETRIES |
2 |
Maximum retry attempts |
headers |
- | [] |
Custom headers for requests |
📚 More Examples & Tutorials
This Laravel package wraps the Claude PHP SDK (v0.6.0+). The main SDK contains 85+ examples and 17 comprehensive tutorials covering advanced topics like:
- 🤖 Agentic Patterns: ReAct, Chain-of-Thought, Tree-of-Thoughts, Plan-and-Execute
- 🔧 Tool Use: Function calling, Computer Use, Bash tools, MCP integration
- 🧠 Extended Thinking: Deep reasoning with thinking budgets
- 📄 Document Processing: PDFs, images, citations
- ⚡ Streaming: Real-time responses with event handling
- 📦 Batch Processing: High-volume request handling
Using SDK Examples with Laravel
All examples in the main SDK can be adapted for Laravel by replacing the client initialization with the Facade:
SDK Example (standalone):
Laravel (using Facade):
Laravel (using Dependency Injection):
👉 Browse Examples | Read Tutorials
What's New in SDK v0.6.0
The underlying claude-php/claude-php-sdk was updated to v0.6.0, adding full parity with the Python SDK v0.80.0. All new features are available through the Claude facade immediately.
Use ModelParam constants for IDE autocomplete and typo-safe model IDs:
See the SDK CHANGELOG for the full v0.6.0 feature list.
Usage Examples
Basic Message
Using in a Controller
System Prompts
Multi-Turn Conversations
Streaming Responses
Streaming with Laravel Response
Vision - Analyzing Images
PDF Document Analysis
Tool Use (Function Calling)
Extended Thinking (Deep Reasoning)
Structured Output (JSON Mode)
Prompt Caching
Listing Available Models
Async Operations
Beta Features - Message Batches
Web Search Integration
Token Counting
🤖 Agentic Laravel
Build intelligent AI agents that can reason, use tools, and solve complex problems autonomously.
📚 For comprehensive tutorials on agentic patterns, see the main SDK tutorials.
ReAct Agent Loop
The ReAct (Reason-Act-Observe) pattern enables iterative problem solving:
Usage:
Multi-Tool Agent with Laravel Services
Integrate Laravel services as tools for your agent:
Agentic Framework with State Management
Build a complete agent framework with task decomposition:
Usage in a Controller:
Streaming Agent Responses
For real-time agent feedback:
Agent with Extended Thinking
For complex reasoning tasks:
Laravel-Specific Patterns
Using with Jobs
Using with Artisan Commands
Using with Service Classes
Testing
Mocking the Facade
Using Fake API Responses
Error Handling
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for details.
Security
If you discover any security-related issues, please use the issue tracker.
License
The MIT License (MIT). Please see License File for more information.
All versions of claude-php-sdk-laravel with dependencies
claude-php/claude-php-sdk Version ^0.5.1|^0.6.0|^1.0
illuminate/contracts Version ^11.0|^12.0
illuminate/support Version ^11.0|^12.0