Download the PHP package alle-ai/anthropic-api-php without Composer

On this page you can find all versions of the php package alle-ai/anthropic-api-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package anthropic-api-php

anthropic-api-php

The go-to PHP library for the Anthropic API. Maintained by Alle-AI.

Latest Version Total Downloads PHP Version

A first-class PHP client for the Anthropic Messages API. Built for Claude 4 and beyond — Messages, streaming, tool use, vision, prompt caching, extended thinking, MCP connector, Files, Batches. Works with the direct API, AWS Bedrock, and Google Vertex AI.

Looking for the v1.x docs? See the 1.x branch. The v1 surface (Alle_AI\Anthropic\AnthropicAPI) is preserved as a deprecation shim through the v2.x line and removed in v3.0. See UPGRADING.md.

Features

Installation

Requires PHP 8.2 or newer.

You'll also need a PSR-18 HTTP client and PSR-17 factories. The most popular choice:

Quick start

From environment

Builder for advanced configuration

Streaming

Tool use

Vision

Prompt caching

Extended thinking

Error handling

Alternative deployments

Same client, different backend.

AWS Bedrock

BedrockAuth::fromEnvironment() uses the AWS default credentials chain (env vars, ~/.aws/credentials, IAM roles, etc.). The auth provider rewrites the URL to bedrock-runtime.{region}.amazonaws.com, transforms the body to Bedrock's expected shape, and signs with SigV4.

Google Vertex AI

VertexAuth::fromEnvironment() uses Google ADC for tokens. Pass projectId explicitly or set GOOGLE_CLOUD_PROJECT; same for region with GOOGLE_CLOUD_REGION.

Custom HTTP client

The SDK auto-discovers a PSR-18 client via php-http/discovery. Inject your own to gain full control:

Roadmap

Tag Status Adds
v2.0.0 shipped Messages create + stream, tool use, vision, prompt caching, extended thinking, citations, Files, Batches, MCP connector, Models listing, PSR-3 logging, Bedrock + Vertex auth, server-side tools (web search / computer use / bash / text editor), Messages::createMany() concurrent fan-out, 14 examples, 186 tests, PHPStan level 9, weekly mutation testing, deprecation shim
v2.x rolling Bug fixes, new Anthropic features as they ship, additional examples
v2.x future Alle-AI sister client (AlleAI\AlleAI\Client) for multi-model fan-out
v3.0.0 future Remove Alle_AI\Anthropic\AnthropicAPI deprecation shim

Migration from v1.x

The single-class v1 surface (Alle_AI\Anthropic\AnthropicAPI::generateText()) is preserved as a deprecation shim. Existing code keeps working — every call emits an E_USER_DEPRECATED notice. Set ALLE_AI_ANTHROPIC_FAIL_ON_DEPRECATED=1 to convert notices into exceptions during migration.

See UPGRADING.md for the full v1 → v2 guide.

About Alle-AI

This library is built and maintained by Alle-AIYour All-In-One AI Platform. Alle-AI gives you a single interface to compare and combine outputs from frontier models (Claude, GPT, Gemini, Llama, and more). If you build on Anthropic and want to evaluate alternatives in the same workflow, check out the platform.

Support

License

MIT © 2023–present Alle-AI. See LICENSE.


All versions of anthropic-api-php with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-curl Version *
ext-json Version *
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.1 || ^2.0
psr/log Version ^2.0 || ^3.0
php-http/discovery Version ^1.19
ramsey/uuid Version ^4.7
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package alle-ai/anthropic-api-php contains the following files

Loading the files please wait ...