In short.
The Anthropic PHP SDK is a client library for developers adding Claude to PHP applications, but buffering HTTP clients delay streaming events until the response finishes. Its documentation describes configurable retries, automatic pagination, tracing, middleware and several cloud platform clients. Authentication requires additional guidance; pricing, licensing and runtime results are not established by this page.
Researched and written by an AI model and checked by a second AI model. How it works
Coverage comprises the complete documentation page at [https://platform.claude.com/docs/en/cli-sdks-libraries/sdks/php.md], including streaming caveats, middleware warnings, beta notices and versioning statements. The captured source SHA-256 is 5813814346fce5b40e3856d0215ff845d7b782a07abe3a9e3bd807a61e8256c7. Linked pages, repository files and package contents are excluded. Installation, runtime behavior, dependency compatibility, model availability, platform authentication, performance and billing behavior remain untested; licensing and redistribution permissions remain unknown.
The overview
Identity
Anthropic documents anthropic-ai/sdk as a Composer package providing access to the Claude API from PHP applications. The PHP SDK page covers language-specific interfaces and configuration, while referring general API questions to a separate reference. The source address is [https://platform.claude.com/docs/en/cli-sdks-libraries/sdks/php.md].
Assessment
Based on its documented features, this SDK appears useful for an existing PHP application that needs Claude messages alongside configurable HTTP behavior. Its strongest practical features are typed exceptions, automatic retries and pagination, and streaming support. Transport selection matters: a buffering client changes when users receive streamed output. Reliability and performance are unassessed.
Users
The main audience is PHP developers integrating Claude into applications. Beginners need familiarity with Composer, credentials, named arguments and iterating over responses. Experienced developers can configure transports, request options, middleware and tracing. Teams using Bedrock, Google Cloud, Claude Platform on AWS or Microsoft Foundry also have documented client options.
Capabilities
The SDK supports message creation, Server-Sent Events streaming, value objects constructed through static with methods or builders, typed errors and automatic iteration through paginated lists. When the application registers an OpenTelemetry tracer provider, the SDK emits a span for each request; exporting spans requires separate setup.
Advanced interfaces allow extra query parameters, body parameters and headers, plus requests to undocumented endpoints through client->request. Platform clients cover Google-managed Claude, Bedrock mantle and runtime, Claude Platform on AWS, Microsoft Foundry and Anthropic-managed Google Cloud. The AWS-platform and Anthropic-managed Google Cloud clients are marked beta.
Using it
Requirements
The stated minimum is PHP 8.1.0. Installation uses Composer, and HTTP requests require a PSR-18 client, which the SDK discovers automatically. Guzzle 7 is recommended because the SDK configures its streaming behavior automatically. Other clients must return response bodies incrementally to deliver live events.
Authentication must match the chosen platform. Personal or service account keys without workspace scope require an anthropic-workspace-id request header. The Claude Platform on AWS client lists aws/aws-sdk-php as a soft dependency; the Anthropic-managed Google Cloud client lists google/auth.
Mechanism
Applications instantiate a client and call methods such as messages->create or messages->createStream. Optional parameters with defaults must be supplied by name. Connection failures and unsuccessful HTTP responses become typed exceptions, including RateLimitException for HTTP 429 and APIConnectionException for network failures.
The default retry policy retries eligible failures twice with short exponential backoff. Eligible cases include connection errors, timeouts and HTTP 408, 409, 429 and 500-or-higher responses. maxRetries can change or disable retries globally or per request. Middleware runs inside this retry loop for every HTTP attempt and can inspect error responses before the SDK raises its status exceptions.
Setup
The documented installation command is composer require "anthropic-ai/sdk" "guzzlehttp/guzzle:^7". Configure credentials for the chosen service before making requests. The page points to authentication guidance at [https://platform.claude.com/docs/en/manage-claude/authentication], but does not provide a complete credential setup.
With Guzzle discovered, streaming configuration is automatic. For another compatible client, the page shows supplying RequestOptions::with(streamingTransporter: $myStreamingClient) through the client's requestOptions. Cloud integrations use their own client classes and initialization methods; detailed platform setup is provided through separate links.
Example
The introductory example creates a Client and calls messages->create with one user message containing Hello, Claude, maxTokens: 1024 and model: 'claude-opus-5-5'. It finds a text block with array_find and prints its text. The streaming example instead calls messages->createStream and prints each event's type. These are documentation examples; the named model's availability and the examples' execution are unverified.
Assessment & evidence
Limitations
Middleware has consequential constraints. Its merged RequestOptions object is shared across middleware and retries and must be treated as read-only. Middleware that reads a response body must rewind it or replace it so decoding can continue; streaming bodies must pass through unread. Extra parameters override documented parameters with matching names.
The page does not provide a default timeout duration or establish compatibility across every supported PHP version. Its introductory example uses array_find without explaining that helper's compatibility across the stated PHP range. Beta platform clients warrant separate evaluation. No installation, code example or API request was executed.
Reasoning
The documented combination of typed errors, retries, pagination and middleware could reduce custom request-handling code in a PHP integration. That is an inference from the interfaces, without measured development-time savings. The tradeoff is responsibility for transport behavior, retry settings and version management. Applications requiring live output should evaluate incremental delivery early because it depends on the HTTP client.
Alternatives
The page does not compare competing PHP libraries. Documented implementation choices include Guzzle or another PSR-18 client, and the main Claude client or platform-specific clients for cloud access. A custom transport needs incremental response bodies for streaming. Comparative costs, authentication effort, feature coverage and reliability across these access routes are not established.
Evidence
The evidence is the complete PHP SDK documentation at [https://platform.claude.com/docs/en/cli-sdks-libraries/sdks/php.md]. It supports statements about documented interfaces, defaults, warnings and examples. It provides no execution logs, performance measurements or production results.
The linked repository [https://github.com/anthropics/anthropic-sdk-php] and package listing [https://packagist.org/packages/anthropic-ai/sdk] identify further resource locations. Their contents, along with linked API, authentication, tracing and platform guides, are outside this report's evidence.
Access & freshness
Costs
The page gives no SDK price, API rates, free allowance or cloud-platform charges. Total usage cost is unknown. The example's maxTokens value does not establish actual token consumption or a request price.
Automatic pagination makes additional network requests, retries repeat eligible attempts, and middleware can send follow-up requests. These behaviors matter when planning usage, but their billing effects are not established by this source.
Rights
The page links to a GitHub repository and Packagist listing but contains no licence text or redistribution grant. The SDK's licence, documentation reuse permissions, commercial-use conditions, service terms and output rights are unknown from this page. Installation instructions alone do not establish those permissions.
Freshness
The documentation snapshot was captured on 15 November 2026 at 09:17:02.107 UTC. The page says the package follows semantic versioning and treats improvements to non-runtime PHPDoc types as non-breaking. It ties the default API version to the SDK's major release and states that version 1.0.0 first uses API version 2026-10-21. The latest package release and subsequent changes are unknown.
Actions
Before integration, confirm your PHP runtime, example-helper compatibility, chosen package release and access to the intended model. Obtain the applicable licence and current service pricing. Follow the authentication guide for your platform and supply the workspace header where required.
In your application, validate a basic message request, incremental stream delivery, retry limits, exception handling and pagination. If adding middleware, check its behavior across retries and ensure response bodies remain usable. These validation tasks have no execution results here.
