PHPackages                             heybardi/routersoup - 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. [Framework](/categories/framework)
4. /
5. heybardi/routersoup

ActiveLibrary[Framework](/categories/framework)

heybardi/routersoup
===================

Openrouter free self-hosted alternative for Laravel

v0.1.0(3mo ago)1201MITPHPPHP ^8.3.0CI passing

Since Mar 16Pushed 3mo agoCompare

[ Source](https://github.com/heybardi/routersoup)[ Packagist](https://packagist.org/packages/heybardi/routersoup)[ Docs](https://github.com/heybardi/routersoup)[ RSS](/packages/heybardi-routersoup/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (1)Dependencies (13)Versions (2)Used By (0)

[  ![RouterSoup for Laravel](art/routersoup.png) ](https://github.com/heybardi)RouterSoup for Laravel
======================

[](#routersoup-for-laravel)

 [![Build Status](https://github.com/heybardi/routersoup/actions/workflows/tests.yml/badge.svg)](https://github.com/heybardi/routersoup/actions) [![Latest Stable Version](https://camo.githubusercontent.com/6b7f6ce7fbed459fbfee49db932dabd4973baaf2a3d1e2594e3615264bb736da/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f68657962617264692f726f75746572736f7570)](https://packagist.org/packages/heybardi/routersoup) [![License](https://camo.githubusercontent.com/27e89b004f9e3fa688bb12f96099140a6c2900165044b490cfa8c58b2660dd85/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f68657962617264692f726f75746572736f7570)](https://packagist.org/packages/heybardi/routersoup)

Your self-hosted, free alternative to [OpenRouter](https://openrouter.ai). Store multiple API keys per provider, rotate between them automatically, and monitor everything from a built-in dashboard.

> **Requires [PHP 8.3+](https://php.net/releases/), [Laravel 11+](https://laravel.com), and [Laravel AI](https://github.com/laravel/ai)**

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Usage](#usage)
- [Rotation Strategies](#rotation-strategies)
- [Dashboard](#dashboard)
- [Authorization](#authorization)
- [Pruning Old Events](#pruning-old-events)
- [Configuration](#configuration)
- [Development](#development)

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

[](#installation)

⚡️ Get started by requiring the package using [Composer](https://getcomposer.org):

```
composer require heybardi/routersoup
```

Then run the install command — it publishes the config, migrations, and a service provider stub:

```
php artisan routersoup:install
php artisan migrate
```

Usage
-----

[](#usage)

Open your `AppServiceProvider` and call `RouterSoup::enable()`:

```
use HeyBardi\RouterSoup\RouterSoup;

class AppServiceProvider extends ServiceProvider
{
    public function boot(): void
    {
        RouterSoup::enable();
    }
}
```

That's it. RouterSoup now intercepts all Laravel AI calls and rotates your provider keys automatically.

Head to `/routersoup` in your browser, add a few API keys, and you're good to go.

Rotation Strategies
-------------------

[](#rotation-strategies)

RouterSoup supports two strategies for picking which API key to use:

StrategyEnumWhat it does**Random**`RouterSoupRotation::Random`Picks a random active key. Simple, stateless.**Least Used**`RouterSoupRotation::LeastUsed`Picks the key that hasn't been used the longest. Spreads load evenly.Set it in `config/routersoup.php`:

```
use HeyBardi\RouterSoup\Enums\RouterSoupRotation;

'rotation' => RouterSoupRotation::LeastUsed,
```

Dashboard
---------

[](#dashboard)

Visit `/routersoup` (or whatever you set `path` to) to access the admin panel:

- **Dashboard** — Provider usage analytics over the last 30 days.
- **Providers** — Add, edit, enable/disable, and delete API keys.
- **Monitoring** — Browse every Laravel AI event with full payloads.
- **Exceptions** — Failed provider calls with error details and traces.

No frontend build step needed — it's all Livewire.

Authorization
-------------

[](#authorization)

In `local` environments, the dashboard is open to everyone. In production, access is controlled by a `viewRouterSoup` gate.

The install command publishes a `RouterSoupServiceProvider` where you define who gets in:

```
// app/Providers/RouterSoupServiceProvider.php

protected function gate(): void
{
    Gate::define('viewRouterSoup', function ($user) {
        return in_array($user->email, [
            'you@example.com',
        ]);
    });
}
```

Pruning Old Events
------------------

[](#pruning-old-events)

Events pile up. Schedule the prune command to keep things clean:

```
$schedule->command('routersoup:prune')->daily();
```

By default it keeps the last 24 hours. Need more? Pass `--hours`:

```
php artisan routersoup:prune --hours=72
```

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

[](#configuration)

After installing, you'll find `config/routersoup.php` in your app:

```
return [
    // URI prefix for the admin panel. Set to null to disable it.
    'path' => env('ROUTERSOUP_PATH', 'routersoup'),

    // Middleware applied to admin panel routes.
    'middleware' => ['web', 'routersoup.auth'],

    // Use a separate DB connection. null = app default.
    'database_connection' => env('ROUTERSOUP_DB', null),

    // Rotation strategy: Random or LeastUsed.
    'rotation' => RouterSoupRotation::Random,

    // Toggle provider usage tracking.
    'analytics' => [
        'enabled' => env('ROUTERSOUP_ANALYTICS', true),
    ],

    // Toggle Laravel AI event monitoring.
    'monitoring' => [
        'enabled' => env('ROUTERSOUP_MONITORING', true),
    ],
];
```

Development
-----------

[](#development)

🧹 Keep a modern codebase with **Pint**:

```
composer lint
```

✅ Run refactors using **Rector**:

```
composer refactor
```

⚗️ Run static analysis using **PHPStan**:

```
composer test:types
```

✅ Run unit tests using **Pest**:

```
composer test:unit
```

🚀 Run the entire test suite:

```
composer test
```

License
-------

[](#license)

**RouterSoup** was created by **[Bardi](https://heybardi.vercel.app)** under the **[MIT license](https://opensource.org/licenses/MIT)**.

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance81

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

100d ago

### Community

Maintainers

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

---

Top Contributors

[![heybardi](https://avatars.githubusercontent.com/u/24764312?v=4)](https://github.com/heybardi "heybardi (1 commits)")

---

Tags

phplaravelOpenRouterroutersoup

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/heybardi-routersoup/health.svg)

```
[![Health](https://phpackages.com/badges/heybardi-routersoup/health.svg)](https://phpackages.com/packages/heybardi-routersoup)
```

###  Alternatives

[unopim/unopim

UnoPim Laravel PIM

10.3k2.2k](/packages/unopim-unopim)[nasirkhan/laravel-starter

A CMS like modular Laravel starter project.

1.4k2.7k](/packages/nasirkhan-laravel-starter)[raugadh/fila-starter

Laravel Filament Starter.

625.1k](/packages/raugadh-fila-starter)

PHPackages © 2026

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