Download the PHP package mohamed-ashraf-elsaed/claude-agent-sdk-laravel without Composer
On this page you can find all versions of the php package mohamed-ashraf-elsaed/claude-agent-sdk-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mohamed-ashraf-elsaed/claude-agent-sdk-laravel
More information about mohamed-ashraf-elsaed/claude-agent-sdk-laravel
Files in mohamed-ashraf-elsaed/claude-agent-sdk-laravel
Package claude-agent-sdk-laravel
Short Description Anthropic Claude Agent SDK for PHP & Laravel — build AI agents with tool use, sandboxing, MCP servers, subagents, hooks, and structured output via the Claude Code CLI
License MIT
Homepage https://github.com/mohamed-ashraf-elsaed/claude-agent-sdk-laravel
Informations about the package claude-agent-sdk-laravel
Claude Agent SDK for Laravel
Build AI agents with Claude Code as a library in your Laravel applications. This SDK wraps the Claude Code CLI to give your app access to file operations, bash commands, code editing, web search, subagents, and more.
Requirements
- PHP 8.1+
- Laravel 10, 11, or 12 and 13
- Claude Code CLI (
npm install -g @anthropic-ai/claude-code) - Anthropic API key
Installation
Publish the config:
Add your API key to .env:
Quick Start
Simple Query
With Options (Fluent API)
Streaming Responses
Stream with Callback
Options Reference
Fluent Builder
From Array
System Prompts
Permission Modes
| Mode | Behavior |
|---|---|
default |
Ask for permission on each tool use |
acceptEdits |
Auto-accept file edits, ask for others |
dontAsk |
Don't ask but log decisions |
bypassPermissions |
Skip all permission checks |
plan |
Create a plan but don't execute |
Custom Permission Handler
For fine-grained control over tool permissions, use canUseTool() to register a callback that approves, denies, or modifies each tool invocation:
Return PermissionResultAllow to approve (optionally with modified input), or PermissionResultDeny with a reason to block the tool call.
Hooks
Run shell commands before or after Claude uses tools. The SDK supports all 12 hook events:
PreToolUse, PostToolUse, PostToolUseFailure, UserPromptSubmit, Notification, SessionStart, SessionEnd, Stop, SubagentStart, SubagentStop, PreCompact, PermissionRequest
HookMatcher Factory Methods
Subagents
Define specialized agents that Claude delegates tasks to:
Structured Output
Get validated JSON responses matching a schema:
Session Resumption
Continue conversations across multiple queries:
MCP Servers
Connect external tools via Model Context Protocol:
Working with Results
Working with Messages
Default Options via Config
Set defaults in config/claude-agent.php or .env:
Options passed to query() override config defaults.
Advanced: Sandbox, Plugins & Betas
Stderr Monitoring
Capture diagnostic output from the Claude CLI process:
Interrupt & Lifecycle
Control a running Claude process programmatically:
Error Handling
Testing
To run with coverage:
Support
If you find this package useful, please consider giving it a star on GitHub. It helps others discover the package and motivates continued development.
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
License
MIT — see LICENSE for details.
All versions of claude-agent-sdk-laravel with dependencies
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/contracts Version ^10.0|^11.0|^12.0
symfony/process Version ^6.0|^7.0