PHPackages                             modelflow-ai/anthropic-adapter - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. modelflow-ai/anthropic-adapter

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

modelflow-ai/anthropic-adapter
==============================

Integrates the anthropic into modelflow-ai.

0.3.0(1y ago)02.4k↓75.8%1MITPHPPHP ^8.2

Since Jul 31Pushed 2mo agoCompare

[ Source](https://github.com/modelflow-ai/anthropic-adapter)[ Packagist](https://packagist.org/packages/modelflow-ai/anthropic-adapter)[ RSS](/packages/modelflow-ai-anthropic-adapter/feed)WikiDiscussions 0.2 Synced 2w ago

READMEChangelogDependencies (13)Versions (8)Used By (1)

 [![Anthropic Adapter Logo](https://avatars.githubusercontent.com/u/152068817?s=768&v=4)](https://avatars.githubusercontent.com/u/152068817?s=768&v=4)

Modelflow AI
Anthropic Adapter

================================

[](#modelflow-aianthropic-adapter)

The adapter integrates Anthropic AI models into Modelflow AI.

> **Note**: This is part of the `modelflow-ai` project create issues in the [main repository](https://github.com/modelflow-ai/.github).

> **Note**: This project is heavily under development and any feedback is greatly appreciated.

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

[](#installation)

To install the Anthropic Adapter package, you need to have PHP 8.2 or higher and Composer installed on your machine. Then, you can add the package to your project by running the following command:

```
composer require modelflow-ai/anthropic-adapter
```

Examples
--------

[](#examples)

Here are some examples of how you can use the Anthropic Adapter in your PHP applications. You can find more detailed examples in the [examples directory](examples).

Usage
-----

[](#usage)

First, initialize the client:

```
use ModelflowAi\Anthropic\Anthropic;

$client = Anthropic::client('your-api-key');
```

Then, you can use the `AnthropicChatModelAdapter`:

```
use ModelflowAi\Chat\Adapter\AIChatAdapterInterface;
use ModelflowAi\Chat\AIChatRequestHandler;
use ModelflowAi\Chat\Request\AIChatRequest;
use ModelflowAi\Chat\Request\Message\AIChatMessage;
use ModelflowAi\Chat\Request\Message\AIChatMessageRoleEnum;
use ModelflowAi\DecisionTree\DecisionTree;
use ModelflowAi\DecisionTree\Criteria\CapabilityCriteria;
use ModelflowAi\DecisionTree\DecisionRule;
use ModelflowAi\Anthropic\Model;
use ModelflowAi\AnthropicAdapter\Chat\AnthropicChatAdapter;
use ModelflowAi\PromptTemplate\ChatPromptTemplate;

$modelAdapter = new AnthropicChatAdapter($client, Model::CLAUDE_3_HAIKU);

/** @var DecisionTreeInterface $decisionTree */
$decisionTree = new DecisionTree([
    new DecisionRule($modelAdapter, [CapabilityCriteria::SMART]),
]);
$handler = new AIChatRequestHandler($decisionTree);

$response = $handler->createRequest(
    ...ChatPromptTemplate::create(
        new AIChatMessage(AIChatMessageRoleEnum::SYSTEM, 'You are an {feeling} bot'),
        new AIChatMessage(AIChatMessageRoleEnum::USER, 'Hello {where}!'),
    )->format(['where' => 'world', 'feeling' => 'angry']),
)
    ->addCriteria(CapabilityCriteria::SMART)
    ->build()
    ->execute();

echo \sprintf('%s: %s', $response->getMessage()->role->value, $response->getMessage()->content);
```

Contributing
------------

[](#contributing)

Contributions are welcome. Please open an issue or submit a pull request in the main repository at .

License
-------

[](#license)

This project is licensed under the MIT License. For the full copyright and license information, please view the LICENSE file that was distributed with this source code.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance64

Regular maintenance activity

Popularity21

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~117 days

Recently: every ~151 days

Total

7

Last Release

20d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e43a10984e8ee1687abaac86c26311c6a607b9560e8a3cc3193f8245751618bc?d=identicon)[wachterjohannes](/maintainers/wachterjohannes)

---

Top Contributors

[![wachterjohannes](https://avatars.githubusercontent.com/u/1464615?v=4)](https://github.com/wachterjohannes "wachterjohannes (12 commits)")

---

Tags

aianthropicmodelflow-ai

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Type Coverage Yes

### Embed Badge

![Health badge](/badges/modelflow-ai-anthropic-adapter/health.svg)

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

###  Alternatives

[cognesy/instructor-php

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

326127.9k1](/packages/cognesy-instructor-php)[symfony/ai-platform

PHP library for interacting with AI platform provider.

521.6M378](/packages/symfony-ai-platform)[soukicz/llm

LLM client with support for cache, tools and async requests

4417.3k](/packages/soukicz-llm)[dykyi-roman/awesome-claude-code

Claude Code extension for PHP: audits (architecture, DDD, security, performance, PSR, design patterns, Docker, CI/CD, tests, docs), 3-level code review, automated bug fix, generators (DDD, CQRS, GoF patterns, PSR, tests, documentation, Docker, CI/CD), code explanation, refactoring. 26 commands, 62 agents, 259 skills.

931.4k](/packages/dykyi-roman-awesome-claude-code)[alidaaer/laravel-ai-agent

Give your Laravel app a brain, safely. Build AI Agents that can execute real actions in your application.

281.0k](/packages/alidaaer-laravel-ai-agent)[wordpress/ai-provider-for-anthropic

AI Provider for Anthropic for the PHP AI Client SDK. Works as both a Composer package and WordPress plugin.

221.3k](/packages/wordpress-ai-provider-for-anthropic)

PHPackages © 2026

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