PHPackages                             webfiori/ai - 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. webfiori/ai

ActiveLibrary

webfiori/ai
===========

Provider-agnostic AI library for PHP. Supports chat completions, embeddings, image generation, tool calling, and streaming across multiple providers.

0.5.1(2w ago)0157[24 issues](https://github.com/WebFiori/ai/issues)[1 PRs](https://github.com/WebFiori/ai/pulls)MITPHPPHP &gt;=8.1CI passing

Since Jul 6Pushed 1mo agoCompare

[ Source](https://github.com/WebFiori/ai)[ Packagist](https://packagist.org/packages/webfiori/ai)[ RSS](/packages/webfiori-ai/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (2)Dependencies (4)Versions (19)Used By (0)

WebFiori AI
===========

[](#webfiori-ai)

A provider-agnostic AI library for PHP. Supports chat completions, embeddings, image generation, tool calling, and streaming across multiple providers (OpenAI, Google, Anthropic, AWS Bedrock).

 [ ![](https://github.com/WebFiori/ai/actions/workflows/php85.yaml/badge.svg?branch=main) ](https://github.com/WebFiori/ai/actions) [ ![](https://camo.githubusercontent.com/97d7b88986f8c3da404b92ce59fdddbd0c98f3358b733d5b16cd1731ae1d6539/68747470733a2f2f636f6465636f762e696f2f67682f57656246696f72692f61692f6272616e63682f6d61696e2f67726170682f62616467652e737667) ](https://codecov.io/gh/WebFiori/ai) [ ![](https://camo.githubusercontent.com/9a6aada1d627f3da0e2a7b12c3ffe5c03639aa6846c48d73ea1aabe45e589375/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d57656246696f72695f6169266d65747269633d616c6572745f737461747573) ](https://sonarcloud.io/dashboard?id=WebFiori_ai) [ ![](https://camo.githubusercontent.com/90c31750aaa9a0a4d62659b2deb6b9d78c8debfd19cb6e5146886c5a1199fecd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f57656246696f72692f61692e7376673f6c6162656c3d6c6174657374) ](https://github.com/WebFiori/ai/releases) [ ![](https://camo.githubusercontent.com/a607b203730808764c78707d7af3388cf0fc43376a7f19cd1c6dd23c3973540b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f77656266696f72692f61693f636f6c6f723d6c696768742d677265656e) ](https://packagist.org/packages/webfiori/ai)

Key Features
------------

[](#key-features)

- **Provider-Agnostic** — Common interface across OpenAI, Google, Anthropic, and AWS Bedrock
- **Chat Completions** — Send messages and receive AI-generated responses
- **Streaming** — Token-by-token streaming via Server-Sent Events
- **Embeddings** — Generate vector embeddings for semantic search
- **Image Generation** — Generate images from text prompts
- **Tool/Function Calling** — Define tools the AI can invoke during conversation
- **Conversation Management** — Built-in conversation history with swappable storage
- **Enterprise Ready** — Retry logic, rate limiting, caching, health checks, metrics, audit logging

Supported PHP Versions
----------------------

[](#supported-php-versions)

Build Status[![](https://github.com/WebFiori/ai/actions/workflows/php81.yaml/badge.svg?branch=main)](https://github.com/WebFiori/ai/actions/workflows/php81.yaml)[![](https://github.com/WebFiori/ai/actions/workflows/php82.yaml/badge.svg?branch=main)](https://github.com/WebFiori/ai/actions/workflows/php82.yaml)[![](https://github.com/WebFiori/ai/actions/workflows/php83.yaml/badge.svg?branch=main)](https://github.com/WebFiori/ai/actions/workflows/php83.yaml)[![](https://github.com/WebFiori/ai/actions/workflows/php84.yaml/badge.svg?branch=main)](https://github.com/WebFiori/ai/actions/workflows/php84.yaml)[![](https://github.com/WebFiori/ai/actions/workflows/php85.yaml/badge.svg?branch=main)](https://github.com/WebFiori/ai/actions/workflows/php85.yaml)Installation
------------

[](#installation)

```
composer require webfiori/ai
```

Quick Start
-----------

[](#quick-start)

```
