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.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package claude-php-sdk-laravel

Claude PHP SDK for Laravel

Latest Version Total Downloads GitHub Stars PHP Version Laravel Version

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

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:

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

PHP Build Version
Package Version
Requires php Version ^8.2
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
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package claude-php/claude-php-sdk-laravel contains the following files

Loading the files please wait ...