Overview

Lets begin by knowing what exactly Claude PHP SDK is and what it does.

What is Claude?

Claude is a family of chatbots developed by Anthropic. It is a competitor to OpenAI’s ChatGPT.

What is Claude PHP SDK?

Claude PHP SDK is a useful PHP library that you can use to communicate with Anthropic’s Claude via API.

It is not a replacement for the claude.ai chatbot interface, though it provides a simple CLI tool to quickly test and check your API key or make quick prompts.

Features

  • Support for all Claude models (Claude 3 Opus/Sonnet/Haiku, Claude 2.1)
  • Streaming responses for real-time output
  • Async request support using Promises
  • Type-safe request/response handling
  • Configurable request parameters (temperature, max tokens, etc)
  • Comprehensive error handling and validation
  • CLI tool for quick testing and API checks

Requirements

  • PHP 8.2 or higher
  • Composer
  • Valid Anthropic API key