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. nunodonato/anthropic-php

ActiveLibrary

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 1mo ago

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

30

—

LowBetter than 64% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity47

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

556d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/501dfaac8eba270f5eebbf213e40efebfe6bf85acb8532512c1b3accad5fcb49?d=identicon)[nunodonato](/maintainers/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

[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[tzsk/sms

A robust and unified SMS gateway integration package for Laravel, supporting multiple providers.

320244.3k6](/packages/tzsk-sms)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

44643.1k1](/packages/pressbooks-pressbooks)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[kerigard/laravel-lang-ru

Ru lang for Laravel

2116.8k](/packages/kerigard-laravel-lang-ru)

PHPackages © 2026

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