socialadsmentor/sam-agentic-harness/anthropic-sdk-php
Claude Code and agent skill by socialadsmentor/sam-agentic-harness
- community
Checking that the SKILL.md file is still in the repository.
Quick reference for the official Anthropic Claude SDK for PHP (package `anthropic-ai/sdk`, requires PHP 8.1+). Covers installation via Composer, client setup, the Messages API, streaming, and tool use. Use when writing or debugging PHP code that calls the Claude API. Triggers: php sdk, anthropic php, claude in php, composer anthropic, php claude client.
Install
npx vskill@latest install socialadsmentor/sam-agentic-harness/anthropic-sdk-phpSKILL.md
The same SKILL.md was published earlier as socialadsmentor/sam-agentic-harness/anthropic-sdk-php.
Anthropic SDK for PHP - Quick Reference
Overview
Official Claude SDK for PHP. Requires PHP 8.1.0+.
- Package:
anthropic-ai/sdk - Docs: https://platform.claude.com/docs/en/api/sdks/php
- Repo: https://github.com/anthropics/anthropic-sdk-php
Installation
Client Initialization
Messages API - Basic
Streaming
Multi-turn Conversation
Tool Use
System Prompt
Available Models
| Model String | Description | |
|---|---|---|
claude-opus-4-6 | Claude Opus 4.6 | |
claude-sonnet-4-20250514 | Claude Sonnet 4 | |
claude-haiku-4-5-20250929 | Claude Haiku 4.5 |
Key Types
| Type | Purpose | |
|---|---|---|
Anthropic\Client | Main client | |
RawMessageStartEvent | Stream: message start | |
RawContentBlockStartEvent | Stream: content block start | |
RawContentBlockDeltaEvent | Stream: content delta (text chunks) | |
RawMessageDeltaEvent | Stream: message delta (stop reason, usage) |
Platform Support
- AWS Bedrock: Dedicated example at
examples/bedrock/ - GCP Vertex: Dedicated example at
examples/vertex/ - Anthropic Foundry: Dedicated example at
examples/foundry/
Error Handling
The SDK throws exceptions for API errors. Wrap calls in try-catch:
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/anthropic-sdk-php/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/socialadsmentor/sam-agentic-harness/anthropic-sdk-php)