PHPackages                             alle-ai/anthropic-api-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. alle-ai/anthropic-api-php

ActiveLibrary

alle-ai/anthropic-api-php
=========================

A PHP library for interacting with Anthropic's API

1.3(2y ago)2723.2k↓34.3%4[1 PRs](https://github.com/Alle-AI/anthropic-api-php/pulls)MITPHPPHP ^7.4 || ^8.0

Since May 4Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Alle-AI/anthropic-api-php)[ Packagist](https://packagist.org/packages/alle-ai/anthropic-api-php)[ Docs](https://github.com/Alle-AI/anthropic-api-php)[ RSS](/packages/alle-ai-anthropic-api-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)DependenciesVersions (6)Used By (0)

Alle-AI anthropic-api-php
=========================

[](#alle-ai-anthropic-api-php)

A PHP library for interacting with Anthropic's API.

Introduction
------------

[](#introduction)

The **Alle-AI anthropic-api-php** is a package that provides a convenient and straightforward way to interact with the **Anthropic Claude** model from your PHP application. For more information contact .

Installation
------------

[](#installation)

The most recommended way to install **Alle-AI anthropic-api-php** is via **composer:**

```
composer require alle-ai/anthropic-api-php
```

Usage
-----

[](#usage)

After installing the **Alle-AI anthropic-api-php** package into your project,

```
// Load your project's composer autoloader (If you aren't already doing so).
require_once(__DIR__ . '/vendor/autoload.php');
```

Authentication
--------------

[](#authentication)

To authenticate your API requests, you will need to provide a valid **API key** from Anthropic

```
$api_key = 'your-anthropic-api-key';
```

Please see the [Anthropic API documentation](https://console.anthropic.com/docs) for more details on obtaining your API key.

Example
-------

[](#example)

Integrating **Anthropic's Claude Model** into your application is now as simple as a few lines of code:

### Chat Completion using Claude (claude-2.1)

[](#chat-completion-using-claude-claude-21)

```
require_once 'vendor/autoload.php'; // Include the Composer autoloader

$api_key = 'your-anthropic-api-key';
$anthropic_version = "2023-06-01";

$anthropic_api = new Alle_AI\Anthropic\AnthropicAPI($api_key, $anthropic_version);
$prompt = "How many toes do dogs have?";
$data = array(
    'prompt' => "\n\nHuman: ".$prompt."\n\nAssistant:", // Be sure to format prompt appropriately
    'model' => 'claude-2.1',
    'max_tokens_to_sample' => 300,
    'stop_sequences' => array("\n\nHuman:")
  );
$response = $anthropic_api->generateText($data);

echo $response['completion']; // To display only completion

// Claude's Response:
// Dogs typically have 4 toes on each of their front paws and 5 toes on each of their back paws, for a total of 18 toes.
```

[Learn more about Anthropic's API](https://console.anthropic.com/docs/api).

Note: Anthropic is rolling out Claude slowly and incrementally. [Please see here on how to get access](https://console.anthropic.com/docs/access).

Support
-------

[](#support)

If you have any questions or feedback, please use the [discussion board](https://github.com/Alle-AI/anthropic-api-php/discussions) or you can send a mail to .

License
-------

[](#license)

This software is copyright (c) 2023-present [Alle-AI | Your All-In-One AI Platform](https://alle-ai.com). This software is free to use, copy, modify, merge, publish, distribute. For copyright and license information, please view the **LICENSE** file.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity38

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~78 days

Total

5

Last Release

799d ago

PHP version history (2 changes)1.1.5PHP ^7.4

1.1.11PHP ^7.4 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/5b8208a304c31daf4b4c363fca55420a86e42297ad615573b6a443237508a9d7?d=identicon)[dickson](/maintainers/dickson)

---

Top Contributors

[![dicksonagyei](https://avatars.githubusercontent.com/u/64383297?v=4)](https://github.com/dicksonagyei "dicksonagyei (39 commits)")[![eneskomur](https://avatars.githubusercontent.com/u/5255758?v=4)](https://github.com/eneskomur "eneskomur (1 commits)")

---

Tags

claudechatbotanthropictext-generationalle-ai

### Embed Badge

![Health badge](/badges/alle-ai-anthropic-api-php/health.svg)

```
[![Health](https://phpackages.com/badges/alle-ai-anthropic-api-php/health.svg)](https://phpackages.com/packages/alle-ai-anthropic-api-php)
```

###  Alternatives

[cognesy/instructor-php

The complete AI toolkit for PHP: unified LLM API, structured outputs, agents, and coding agent control

310107.9k1](/packages/cognesy-instructor-php)[vizra/vizra-adk

Vizra Agent Development Kit - A comprehensive Laravel package for building intelligent AI agents.

29026.1k](/packages/vizra-vizra-adk)[mozex/anthropic-laravel

Anthropic PHP for Laravel is a supercharged PHP API client that allows you to interact with the Anthropic API

71226.4k1](/packages/mozex-anthropic-laravel)[mozex/anthropic-php

Anthropic PHP is a supercharged community-maintained PHP API client that allows you to interact with Anthropic API.

46365.1k13](/packages/mozex-anthropic-php)[helgesverre/toon

Token-Oriented Object Notation - A compact data format for reducing token consumption when sending structured data to LLMs

11841.4k9](/packages/helgesverre-toon)[claude-php/claude-php-sdk

A universal, framework-agnostic PHP SDK for the Anthropic Claude API with PSR compliance

13920.7k2](/packages/claude-php-claude-php-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
