PHPackages                             artisan-build/claudecode - 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. artisan-build/claudecode

ActiveLibrary

artisan-build/claudecode
========================

A Claude Code SDK for Laravel

253↓100%PHPCI passing

Since Oct 20Pushed 6mo agoCompare

[ Source](https://github.com/artisan-build/claudecode)[ Packagist](https://packagist.org/packages/artisan-build/claudecode)[ RSS](/packages/artisan-build-claudecode/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![Artisan Build Package Claude Code Logo](https://github.com/artisan-build/claudecode/raw/HEAD/art/claudecode.png)](https://github.com/artisan-build/claudecode/raw/HEAD/art/claudecode.png)

Claude Code SDK for Laravel
===========================

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

A Laravel package that provides a seamless integration with Claude Code, allowing you to execute AI-powered coding tasks directly from your Laravel application.

Warning

This package is currently under active development, and we have not yet released a major version. Once a 0.\* version has been tagged, we strongly recommend locking your application to a specific working version because we might make breaking changes even in patch releases until we've tagged 1.0.

Requirements
------------

[](#requirements)

- PHP 8.3+
- Laravel 11.0+
- Claude CLI installed (`claude` command available)
- Anthropic API key

Installation
------------

[](#installation)

```
composer require artisan-build/claudecode
```

Configuration
-------------

[](#configuration)

Publish the configuration file:

```
php artisan vendor:publish --tag=claude-code-config
```

Set your Anthropic API key in your `.env` file:

```
ANTHROPIC_API_KEY=your-api-key-here
```

Additional configuration options:

```
CLAUDE_CLI_PATH=claude
CLAUDE_TIMEOUT=120
CLAUDE_MODEL=claude-3-5-sonnet-20241022
CLAUDE_PERMISSION_MODE=auto
CLAUDE_ALLOWED_TOOLS=Read,Write,Edit
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

```
use ArtisanBuild\ClaudeCode\Facades\ClaudeCode;

// Simple query
$response = ClaudeCode::query('Write a function to calculate factorial')
    ->get();

// With options
$response = ClaudeCode::query('Analyze this codebase and suggest improvements')
    ->withModel('claude-3-5-sonnet-20241022')
    ->withWorkingDirectory('/path/to/project')
    ->allowTools(['Read', 'Grep', 'Glob'])
    ->execute();
```

### Using the Task Helper

[](#using-the-task-helper)

```
use ArtisanBuild\ClaudeCode\Support\ClaudeCodeTask;

$task = ClaudeCodeTask::create('Refactor the UserController')
    ->inDirectory(base_path('app/Http/Controllers'))
    ->allowTools(['Read', 'Edit', 'Write'])
    ->run();

if ($task->isSuccessful()) {
    echo $task->getResult();
} else {
    echo "Error: " . $task->getError();
}
```

### Streaming Responses

[](#streaming-responses)

```
ClaudeCode::query('Build a REST API for managing books')
    ->stream(function ($message) {
        echo $message->getTextContent() . "\n";
    });
```

### Session Management

[](#session-management)

```
use ArtisanBuild\ClaudeCode\Support\ClaudeCodeSession;

$session = new ClaudeCodeSession(app(ClaudeCode::class));

// First prompt
$session->prompt('Create a new Laravel model for Product');

// Follow-up prompt (maintains context)
$session->prompt('Now create a migration for this model');

// Get all responses
$allMessages = $session->getMessages();
$lastResponse = $session->getLastResponse();
```

### Tool Management

[](#tool-management)

```
use ArtisanBuild\ClaudeCode\Support\ClaudeCodeTools;

// Use predefined tool sets
$response = ClaudeCode::query('Analyze the codebase')
    ->allowTools(ClaudeCodeTools::readOnlyTools())
    ->execute();

// Check what tools were used
$task = ClaudeCodeTask::create('Update all tests')
    ->allowTools(ClaudeCodeTools::fileTools())
    ->run();

if ($task->hasUsedTools()) {
    $toolNames = $task->getUsedToolNames(); // ['Read', 'Edit', 'Write']
}
```

### Advanced Options

[](#advanced-options)

```
use ArtisanBuild\ClaudeCode\Support\ClaudeCodeOptions;

$options = ClaudeCodeOptions::create()
    ->systemPrompt('You are a Laravel expert. Follow PSR-12 standards.')
    ->maxTurns(10)
    ->model('claude-3-5-sonnet-20241022')
    ->permissionMode('auto')
    ->workingDirectory(base_path())
    ->allowedTools(['Read', 'Write', 'Edit', 'Bash']);

$response = ClaudeCode::query('Implement user authentication')
    ->withOptions($options)
    ->execute();
```

Memberware
----------

[](#memberware)

This package is part of our internal toolkit and is optimized for our own purposes. We do not accept issues or PRs in this repository.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance48

Moderate activity, may be stable

Popularity13

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/55eed7400c452edf7e7adfa4f1c6676b65b5ce1867fff6bddcb80b1bb45360af?d=identicon)[edgrosvenor](/maintainers/edgrosvenor)

---

Top Contributors

[![edgrosvenor](https://avatars.githubusercontent.com/u/1053395?v=4)](https://github.com/edgrosvenor "edgrosvenor (14 commits)")

### Embed Badge

![Health badge](/badges/artisan-build-claudecode/health.svg)

```
[![Health](https://phpackages.com/badges/artisan-build-claudecode/health.svg)](https://phpackages.com/packages/artisan-build-claudecode)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
