mohamed-ashraf-elsaed/claude-agent-sdk-laravel
No code changes — all features from v1.3.0 are included.
composer update mohamed-ashraf-elsaed/claude-agent-sdk-laravel
This release brings complete feature parity with the official TypeScript and Python Claude Agent SDKs. 22 new features, 105 new tests, zero regressions.
Custom Permission Handling — The most requested feature. Control exactly what the agent can do:
use ClaudeAgentSDK\Permissions\PermissionResultAllow;
use ClaudeAgentSDK\Permissions\PermissionResultDeny;
$options = ClaudeAgentOptions::make()
->canUseTool(function (string $toolName, array $input) {
if ($toolName === 'Bash' && str_contains($input['command'] ?? '', 'rm -rf')) {
return new PermissionResultDeny('Destructive commands blocked');
}
// Redirect writes to sandbox
if ($toolName === 'Write') {
return new PermissionResultAllow(
updatedInput: array_merge($input, ['file_path' => '/sandbox' . $input['file_path']])
);
}
return new PermissionResultAllow();
});
Stderr Monitoring — Capture CLI debug output:
$options->stderr(function (string $data) {
Log::warning('Claude CLI: ' . $data);
});
Detailed Error Handling — Know exactly why the agent stopped:
$result = ClaudeAgent::query('...', $options);
$result->subtype(); // 'error_max_turns', 'error_max_budget_usd', etc.
$result->isMaxTurnsError(); // true if hit turn limit
$result->isBudgetError(); // true if budget exceeded
$result->permissionDenials(); // denied tool uses
$result->errors(); // execution errors
Session Introspection — See what the agent has access to:
$result->model(); // Model used
$result->availableTools(); // Available tools
$result->mcpServerStatus(); // MCP server statuses
$result->supportedCommands(); // Slash commands
canUseTool(callable) — Custom permission handler with IPC (runs in your PHP process)stderr(callable) — Stderr output callbackPermissionResultAllow / PermissionResultDeny — Permission result typesPostToolUseFailure, Notification, SessionStart, SessionEnd, SubagentStart, PermissionRequest (12 total)McpServerConfig::http() — HTTP transport for MCP serverspermissionPromptToolName(string) — MCP permission prompt tooltools, model, mcpServers, permissionMode, slashCommands, apiKeySource, cwdpermissionDenials and errors fieldsPartialAssistantMessage — Streaming partial event typerewindFiles(sessionId, messageUuid) — File checkpoint restorationinterrupt() — Graceful agent interruptionplan — Plan without executingallowDangerouslySkipPermissions(bool) — Safety guardresumeSessionAt(string) — Resume at specific message UUIDmodel(), availableTools(), mcpServerStatus(), supportedCommands()interrupt(), isRunning(), supportedCommands(), lastModel(), mcpServerStatus(), availableTools()composer update mohamed-ashraf-elsaed/claude-agent-sdk-laravel
Full Changelog: https://github.com/mohamed-ashraf-elsaed/claude-agent-sdk-laravel/compare/v1.2.1...v1.3.0
--settings flag instead of the invalid --sandbox CLI flag (#2, #3)The --sandbox CLI flag does not exist in the Claude Code CLI. The SDK now correctly passes sandbox configuration through the --settings flag as a JSON settings object, matching the official Claude SDK behavior.
The sandbox() method now expects the official SandboxSettings structure:
$options = ClaudeAgentOptions::make()
->sandbox([
'enabled' => true,
'autoAllowBashIfSandboxed' => true,
'excludedCommands' => ['docker'],
'network' => [
'allowLocalBinding' => true,
'allowUnixSockets' => ['/var/run/docker.sock'],
],
]);
composer update mohamed-ashraf-elsaed/claude-agent-sdk-laravel
Full Changelog: https://github.com/mohamed-ashraf-elsaed/claude-agent-sdk-laravel/compare/v1.2.0...v1.2.1
How can I help you explore Laravel packages today?