PHPackages                             illuma-law/laravel-prompt-registry - 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. illuma-law/laravel-prompt-registry

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

illuma-law/laravel-prompt-registry
==================================

Dynamic AI agent prompt registration and retrieval for Laravel.

v0.1.4(1mo ago)062MITPHPPHP ^8.3CI passing

Since Apr 20Pushed 1mo agoCompare

[ Source](https://github.com/illuma-law/laravel-prompt-registry)[ Packagist](https://packagist.org/packages/illuma-law/laravel-prompt-registry)[ Docs](https://github.com/illuma-law/laravel-prompt-registry)[ RSS](/packages/illuma-law-laravel-prompt-registry/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (15)Versions (6)Used By (0)

Laravel Prompt Registry
=======================

[](#laravel-prompt-registry)

[![Run Tests](https://github.com/illuma-law/laravel-prompt-registry/actions/workflows/run-tests.yml/badge.svg)](https://github.com/illuma-law/laravel-prompt-registry/actions/workflows/run-tests.yml)[![PHPStan](https://github.com/illuma-law/laravel-prompt-registry/actions/workflows/phpstan.yml/badge.svg)](https://github.com/illuma-law/laravel-prompt-registry/actions/workflows/phpstan.yml)[![Latest Version on Packagist](https://camo.githubusercontent.com/894505364670a63c9ab426f26f6338ef11c355f89a990332ae46d0e45149546e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696c6c756d612d6c61772f6c61726176656c2d70726f6d70742d72656769737472792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/illuma-law/laravel-prompt-registry)[![Total Downloads](https://camo.githubusercontent.com/fd32409985d1c038fab3036e550e71156fa1e7773fbfcf3a6705e739696afb93/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f696c6c756d612d6c61772f6c61726176656c2d70726f6d70742d72656769737472792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/illuma-law/laravel-prompt-registry)[![License](https://camo.githubusercontent.com/6601fd1ab5c56d01784c67438e0dbf802070ee42c20020b044d799575da36048/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f696c6c756d612d6c61772f6c61726176656c2d70726f6d70742d72656769737472792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/illuma-law/laravel-prompt-registry)

A lightweight, dynamic registry for AI agent prompt definitions in Laravel.

This package provides a centralized system to register and look up AI prompt metadata across your Laravel application. Instead of hardcoding AI agent configurations, you can register an agent's associated class, name, description, fallback Blade views, and LLM tiers (Standard vs Extended) either via configuration or programmatically.

Features
--------

[](#features)

- **Centralized Configuration:** Define all your application's AI prompts in a single config file.
- **Dynamic Registration:** Register prompts on the fly from Service Providers or external packages.
- **Bidirectional Lookup:** Fetch prompt definitions by their string key, or look up the configuration using the Agent's class name.
- **Tier Routing:** Built-in support for defining whether an agent requires an 'extended' (smarter/larger) model tier or can operate on a 'standard' tier by default.
- **Dependency Injection &amp; Facade:** Use the `PromptRegistry` facade for quick access, or inject `PromptRegistryManager` for robust testing.

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

[](#installation)

Install the package via Composer:

```
composer require illuma-law/laravel-prompt-registry
```

Publish the config file:

```
php artisan vendor:publish --tag="laravel-prompt-registry-config"
```

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

[](#configuration)

The published `config/prompt-registry.php` holds an array where each key is a dot-notation identifier for the prompt definition:

```
return [
    'prompts' => [
        'agents.content_creator' => [
            'agent'                => \App\Ai\Agents\ContentCreatorAgent::class,
            'name'                 => 'Content Creator Agent',
            'description'          => 'Generates marketing social content.',
            'fallback_view'        => 'prompts.agents.content_creator',
            'default_primary_tier' => 'standard', // Optional: 'standard' | 'extended'
        ],
        'agents.legal_analyst' => [
            'agent'                => \App\Ai\Agents\LegalAnalystAgent::class,
            'name'                 => 'Legal Analyst',
            'description'          => 'Analyzes complex legal documents.',
            'fallback_view'        => 'prompts.agents.legal_analyst',
            'default_primary_tier' => 'extended',
        ],
    ],
];
```

Usage &amp; Integration
-----------------------

[](#usage--integration)

### Programmatic Registration

[](#programmatic-registration)

While configuration is the easiest method, you can register prompts anywhere (like in a package's `ServiceProvider`):

```
use IllumaLaw\PromptRegistry\Facades\PromptRegistry;

// Register a single prompt
PromptRegistry::register('agents.custom', [
    'agent'         => \App\Ai\Agents\CustomAgent::class,
    'name'          => 'Custom Agent',
    'description'   => 'A custom agent for specialized tasks.',
    'fallback_view' => 'prompts.agents.custom',
]);

// Register multiple prompts
PromptRegistry::registerMany([
    // ...
]);
```

### Retrieving Prompts

[](#retrieving-prompts)

The package provides multiple ways to fetch the registered definitions:

```
use IllumaLaw\PromptRegistry\Facades\PromptRegistry;
use App\Ai\Agents\ContentCreatorAgent;

// Look up by registry key
$definition = PromptRegistry::forKey('agents.content_creator');
// Returns array: ['agent' => '...', 'name' => '...', 'description' => '...', ...]

// Look up by Agent class name
$definition = PromptRegistry::forAgent(ContentCreatorAgent::class);

// Get the default primary tier directly for routing (returns 'standard' or 'extended')
$tier = PromptRegistry::defaultPrimaryTierForAgent(ContentCreatorAgent::class);

// Get all registered prompts (flat list)
$all = PromptRegistry::all();

// Get all registered prompts, keyed by their registry key
$byKey = PromptRegistry::definitionsByKey();
```

### Exception Handling

[](#exception-handling)

If you attempt to retrieve a prompt that hasn't been registered, the registry will throw an `\InvalidArgumentException`. This enforces strict configuration correctness.

```
use IllumaLaw\PromptRegistry\Facades\PromptRegistry;

try {
    $definition = PromptRegistry::forKey('agents.unknown');
} catch (\InvalidArgumentException $e) {
    // "No prompt definition was registered for key [agents.unknown]."
}
```

### Dependency Injection

[](#dependency-injection)

You can resolve the underlying `PromptRegistryManager` from the Laravel container directly if you prefer dependency injection over Facades:

```
namespace App\Services;

use IllumaLaw\PromptRegistry\PromptRegistryManager;

class PromptService
{
    public function __construct(
        protected PromptRegistryManager $registry
    ) {}

    public function handle(): void
    {
        $definition = $this->registry->forKey('agents.content_creator');
    }
}
```

Testing
-------

[](#testing)

The test suite uses Pest and maintains 100% code coverage.

```
# Run tests
composer test

# Run static analysis
composer analyse
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance91

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

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

5

Last Release

44d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2affac64f2726a640084b203503518ca01f582536d60a0a299b614486ed95aaa?d=identicon)[miguelenes](/maintainers/miguelenes)

---

Top Contributors

[![miguelenes](https://avatars.githubusercontent.com/u/1568086?v=4)](https://github.com/miguelenes "miguelenes (10 commits)")

---

Tags

laravelaiAgentregistryprompt

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/illuma-law-laravel-prompt-registry/health.svg)

```
[![Health](https://phpackages.com/badges/illuma-law-laravel-prompt-registry/health.svg)](https://phpackages.com/packages/illuma-law-laravel-prompt-registry)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3325.1M337](/packages/psalm-plugin-laravel)[spatie/laravel-health

Monitor the health of a Laravel application

88011.3M149](/packages/spatie-laravel-health)[laravel/ai

The official AI SDK for Laravel.

9782.1M153](/packages/laravel-ai)[laracraft-tech/laravel-useful-additions

A collection of useful Laravel additions!

58122.8k](/packages/laracraft-tech-laravel-useful-additions)[simplestats-io/laravel-client

Analytics for Laravel. Track visitors, registrations, and payments. Discover which channels actually drive revenue, not just traffic. Server-side, GDPR compliant, ad-blocker proof.

5019.3k](/packages/simplestats-io-laravel-client)

PHPackages © 2026

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