PHPackages                             purewater2011/claude-code-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. purewater2011/claude-code-sdk

ActiveLibrary

purewater2011/claude-code-sdk
=============================

PHP SDK for Claude Code

06PHP

Since Oct 9Pushed 7mo agoCompare

[ Source](https://github.com/purewater2011/claude-code-sdk)[ Packagist](https://packagist.org/packages/purewater2011/claude-code-sdk)[ RSS](/packages/purewater2011-claude-code-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Claude Code SDK for PHP
=======================

[](#claude-code-sdk-for-php)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d2099b045afad8a2a24869f88089c4975c583925d4a7bbb6d347ecea7a37b64f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f707572657761746572323031312f636c617564652d636f64652d73646b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/purewater2011/claude-code-sdk)[![Total Downloads](https://camo.githubusercontent.com/5fced7cf4fc302c4313dcec7d6251869615be3eb1ddb6c663a5e38fc28266f5b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f707572657761746572323031312f636c617564652d636f64652d73646b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/purewater2011/claude-code-sdk)

PHP wrapper for [Claude Code](https://github.com/anthropics/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
------------

[](#installation)

```
composer require purewater2011/claude-code-sdk
```

Make sure Claude Code CLI is installed:

```
npm install -g @anthropic-ai/claude-code
```

PHP 7.4+ Compatibility
----------------------

[](#php-74-compatibility)

This SDK is fully compatible with **PHP 7.4 and higher** using modern PHP patterns:

### Key Features

[](#key-features)

**Fluent Interface** - Chain methods for clean configuration:

```
$options = Options::create()
    ->systemPrompt('You are a helpful assistant')
    ->allowedTools(['Read', 'Write'])
    ->maxTurns(5);
```

**PermissionMode** - Use static methods:

```
PermissionMode::default()       // Default permission mode
PermissionMode::acceptEdits()   // Auto-accept edits
PermissionMode::bypassPermissions()  // Bypass all permission checks
```

**MCP Server Config** - Easy server configuration:

```
MCPServerConfig::stdio('node', ['server.js'])
MCPServerConfig::sse('https://api.example.com/sse')
MCPServerConfig::http('https://api.example.com/mcp')
```

> **Note:** All examples in this README use the fluent interface pattern, which is the recommended approach for PHP 7.4+. See [PHP74\_MIGRATION.md](PHP74_MIGRATION.md) for detailed compatibility information.

Quick Start
-----------

[](#quick-start)

### Basic Usage

[](#basic-usage)

```
