PHPackages                             nunodonato/anthropic-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. [API Development](/categories/api)
4. /
5. nunodonato/anthropic-php

ActiveLibrary[API Development](/categories/api)

nunodonato/anthropic-php
========================

A PHP client for the Anthropic API

0.1.6(1y ago)4821MITPHPPHP ^8.1

Since Apr 8Pushed 1y ago1 watchersCompare

[ Source](https://github.com/nunodonato/anthropic-php)[ Packagist](https://packagist.org/packages/nunodonato/anthropic-php)[ RSS](/packages/nunodonato-anthropic-php/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (4)Versions (15)Used By (0)

A simple PHP library to connect to Anthropic APIs (Claude).

I created this package to fulfill my own needs on my AI projects. I am aware that there are other similar packages, but either they didn't have all the required features or I just didn't like the implementation and usage.

### Features

[](#features)

- Messages API
- Support multi-content messages (Vision)
- Tool usage (*beta*)
- Completion API (*legacy*)
- Prompt caching (system message only, for now)
- Helps you build and validate messages/tools data structures before sending to the API

#### Roadmap

[](#roadmap)

- Streaming

### Installation

[](#installation)

`composer require nunodonato/anthropic-php`

### Usage

[](#usage)

More soon.

#### Instantiate the client

[](#instantiate-the-client)

```
use NunoDonato\AnthropicAPIPHP\Client;

// ...

$client = new Client($yourApiKey);
```

#### Messages API usage

[](#messages-api-usage)

```
use NunoDonato\AnthropicAPIPHP\Client;
use NunoDonato\AnthropicAPIPHP\Messages;

// ...

$client = new Client($yourApiKey);
$messages = new Messages();
$messages->addUserTextMessage('Hello AI!');

$response = $this->client->messages(Client::MODEL_SONNET, $messages);

// you can chain messages
$messages->addUserTextMessage('Hello AI!')
        ->addAssistantTextMessage('Hello human!')
        ->addUserImageMessage('https://example.com/image.jpg', 'What do you see here?');
```

#### Available models

[](#available-models)

```
const MODEL_OPUS = 'claude-3-opus-20240229';
const MODEL_SONNET = 'claude-3-sonnet-20240229';
const MODEL_HAIKU = 'claude-3-haiku-20240307';
const MODEL_3_5_SONNET = 'claude-3-5-sonnet-latest';
const MODEL_3_5_HAIKU = 'claude-3-5-haiku-latest';
const MODEL_CLAUDE_2 = 'claude-2.1';
```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.2% 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 ~17 days

Recently: every ~33 days

Total

13

Last Release

602d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1642015?v=4)[Nuno Donato](/maintainers/nunodonato)[@nunodonato](https://github.com/nunodonato)

---

Top Contributors

[![nunodonato](https://avatars.githubusercontent.com/u/1642015?v=4)](https://github.com/nunodonato "nunodonato (35 commits)")[![nmenescardi](https://avatars.githubusercontent.com/u/9052060?v=4)](https://github.com/nmenescardi "nmenescardi (1 commits)")

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/nunodonato-anthropic-php/health.svg)

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

815320.5k3](/packages/defstudio-telegraph)[flat3/lodata

OData v4.01 Producer for Laravel

99351.7k](/packages/flat3-lodata)[simplestats-io/laravel-client

Analytics for Laravel. Track visitors, registrations, and payments. Discover which channels actually drive revenue, not just traffic. Server-side, GDPR compliant, ad-blocker proof.

5019.3k](/packages/simplestats-io-laravel-client)[jasara/php-amzn-selling-partner-api

A fluent interface for Amazon's Selling Partner API in PHP

1348.7k1](/packages/jasara-php-amzn-selling-partner-api)

PHPackages © 2026

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