定制 artisan-build/claudecode 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

artisan-build/claudecode

Composer 安装命令:

composer require artisan-build/claudecode

包简介

A Claude Code SDK for Laravel

README 文档

README

Artisan Build Package Claude Code Logo

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

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

Installation

composer require artisan-build/claudecode

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

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

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

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

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

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

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

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.

artisan-build/claudecode 适用场景与选型建议

artisan-build/claudecode 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 149 次下载、GitHub Stars 达 2, 最近一次更新时间为 2025 年 07 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 artisan-build/claudecode 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 artisan-build/claudecode 我们能提供哪些服务?
定制开发 / 二次开发

基于 artisan-build/claudecode 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 149
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 12
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-08