Download the PHP package helgesverre/claude-code-sdk without Composer

On this page you can find all versions of the php package helgesverre/claude-code-sdk. 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-code-sdk

Claude Code SDK for PHP

Latest Version on Packagist Total Downloads

PHP wrapper for Claude Code. Fun fact: This SDK was built by using Claude Code to port its own Python SDK to PHP. 🤖

Stream Claude's responses, track token usage, hook into events, and integrate AI coding assistance into your PHP apps.

Installation

Make sure Claude Code CLI is installed:

Quick Start

Basic Usage

With Options


Usage in Laravel

Configuration

Publish the configuration file:

Configure your settings in config/claude-code.php or use environment variables:

Using the Facade

Dependency Injection

Configuration Options

Options

All configuration options available:

Message Types

The SDK provides strongly-typed message classes with proper DTOs:

SystemMessage

System events with typed data for initialization:

AssistantMessage

Contains content blocks with Claude's responses:

UserMessage

User input and tool feedback:

ResultMessage

Session completion with usage metrics:

MCP Server Configuration

Configure Model Context Protocol servers:

Interceptors

Note: This is NOT related to or the same as Claude Code Hooks

The SDK supports interceptors that allow you to tap into various events during the Claude Code lifecycle. This is useful for logging, monitoring, debugging, or building real-time UI updates.

Available Hook Points

Basic Usage

Example Interceptors

File Logger

Metrics Collector

Webhook Dispatcher

Custom Interceptor

Laravel Integration

Error Handling

The SDK provides specific exception types for different failure scenarios:

License

This SDK is open-source software licensed under the MIT license.


All versions of claude-code-sdk with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
ext-json Version *
symfony/process Version ^7.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 helgesverre/claude-code-sdk contains the following files

Loading the files please wait ....