PHP SDK for Cloud AI Agents
Overview
The official PHP SDK for Chucky, a Composer package (chucky-cloud/sdk) that lets PHP applications create sessions with Claude-powered agents, mint scoped tokens server-side, and stream responses from the cloud platform.
Why It Exists
A large share of web backends run on PHP. This SDK gives those applications a modern, typed way to embed cloud AI agents and to safely mint budget-scoped tokens from the server before handing them to clients.
What We Built
A PSR-style package targeting PHP 8.1+: src/Chucky.php entry point, Client/ChuckyClient.php and Client/Session.php for clients and sessions, Tools/McpServer.php and Tools/Tool.php for custom tools and MCP, Transport/WebSocketTransport.php, a Types/ namespace (Enums, Messages, Options, Errors) using PHP enums for models and budget windows, and Utils/Token.php exposing createToken/createBudget. The package includes worked examples/ (basic and with-tools) and a PHPUnit test suite.
Technologies & Approach
Modern PHP 8.1 with enums and typed value objects, distributed via Composer. Token minting lives server-side (createToken with an HMAC secret and a budget), matching the security model of the TypeScript reference SDK so behaviour is consistent across languages.
Outcome / Impact
Makes the platform usable from PHP backends with the same session, streaming, tools, and MCP feature set as the other SDKs, installable via Composer.
Capabilities Demonstrated
- Modern PHP 8.1 package design (enums, typed options)
- Server-side budget-token minting
- Custom tools and MCP server support
- Cross-language protocol parity