PHPackages                             omer-hanaraey/laravel-ai-gateway - 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. omer-hanaraey/laravel-ai-gateway

ActiveLibrary

omer-hanaraey/laravel-ai-gateway
================================

A unified interface for multiple AI providers in Laravel

v0.3.0(1y ago)07MITPHPPHP ^8.1 || ^8.2 || ^8.3 || ^8.4CI failing

Since Apr 9Pushed 1y ago1 watchersCompare

[ Source](https://github.com/omer-hanaraey/laravel-ai-gateway)[ Packagist](https://packagist.org/packages/omer-hanaraey/laravel-ai-gateway)[ RSS](/packages/omer-hanaraey-laravel-ai-gateway/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (7)Versions (5)Used By (0)

Laravel AI Bridge
=================

[](#laravel-ai-bridge)

A unified interface for multiple AI providers in Laravel applications.

Features
--------

[](#features)

- Support for multiple AI providers (OpenAI, Gemini, Claude, DeepSeek, Mistral, and Cohere)
- Unified API interface
- Easy driver switching
- Standardized response format
- Facade access

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

[](#installation)

1. Install via Composer:

```
composer require omer-hanaraey/laravel-ai-gateway
```

2. Publish the configuration file:

```
php artisan vendor:publish --tag=ai-bridge-config
```

Configuration
-------------

[](#configuration)

Add your API keys to your .env file:

```
AI_DEFAULT_DRIVER=openai

OPENAI_API_KEY=your_openai_key
OPENAI_MODEL=gpt-3.5-turbo

GEMINI_API_KEY=your_gemini_key
GEMINI_MODEL=gemini-pro

CLAUDE_API_KEY=your_claude_key
CLAUDE_MODEL=claude-2

DEEPSEEK_API_KEY=your_deepseek_key
DEEPSEEK_MODEL=deepseek-chat

MISTRAL_API_KEY=your_mistral_key
MISTRAL_MODEL=mistral-large-latest

COHERE_API_KEY=your_cohere_key
COHERE_MODEL=command-a-03-2025
COHERE_CLIENT_NAME=your_cohere_client
```

Usage
-----

[](#usage)

Usage Examples 🧑‍💻

```
use LaravelAiGateway\Ai\Facades\Ai;

$response = Ai::chat([
    ['role' => 'system', 'content' => 'You are a helpful assistant'],
    ['role' => 'user', 'content' => 'Tell me a joke about Laravel']
]);

echo $response->getContent();
```

Using Specific Drivers

```
$response = Ai::driver('claude')
    ->withModel('claude-3-haiku-20240307')
    ->chat([...]);
```

### Available Methods

[](#available-methods)

- `chat(array $messages)`: Send chat completion
- `driver(string $name)`: Switch between providers

### Response Format 📦

[](#response-format-)

All responses implement `AiResponseInterface` with these methods:

- `getContent()`: string - Get the response content
- `getUsage()`: array - Get usage statistics
- `isSuccessful()`: bool - Check if request succeeded

### Testing 🧪

[](#testing--)

Run the tests with:

```
composer test tests
```

### Contributing

[](#contributing)

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

### License 📄

[](#license-)

MIT License - Free for commercial and personal use.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance47

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community7

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 ~2 days

Total

4

Last Release

393d ago

PHP version history (2 changes)v0.0.1PHP ^8.1 || ^8.2 || ^8.3

v0.3.0PHP ^8.1 || ^8.2 || ^8.3 || ^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/8ffea88bf424d58bebe6bfc603809e83363cd5f0b00f223bb07367b86166b578?d=identicon)[omer-hamza](/maintainers/omer-hamza)

---

Top Contributors

[![omer-hanaraey](https://avatars.githubusercontent.com/u/63197922?v=4)](https://github.com/omer-hanaraey "omer-hanaraey (23 commits)")

---

Tags

aiclaudecohere-aideepseekgiminimistralopenai

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/omer-hanaraey-laravel-ai-gateway/health.svg)

```
[![Health](https://phpackages.com/badges/omer-hanaraey-laravel-ai-gateway/health.svg)](https://phpackages.com/packages/omer-hanaraey-laravel-ai-gateway)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M2.6k](/packages/craftcms-cms)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[spatie/laravel-export

Create a static site bundle from a Laravel app

646127.9k5](/packages/spatie-laravel-export)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[mailersend/laravel-driver

MailerSend Laravel Driver

87732.8k4](/packages/mailersend-laravel-driver)[kirschbaum-development/laravel-openapi-validator

Automatic OpenAPI validation for Laravel HTTP tests

581.1M5](/packages/kirschbaum-development-laravel-openapi-validator)

PHPackages © 2026

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