Prompt Deck: Manage AI Prompts as Versioned Files in Laravel

Last updated on by

Prompt Deck: Manage AI Prompts as Versioned Files in Laravel image

Prompt Deck by Victor Ukam gives Laravel applications a structured way to manage AI prompts — storing them as versioned markdown files on disk rather than embedding strings directly in application code.

The package requires PHP 8.2+ and Laravel 11+.

Key features:

  • Disk-based prompt files with directory-based versioning
  • Variable interpolation using {{ $variable }} syntax in markdown files
  • Artisan commands for creating, listing, testing, and activating prompt versions
  • A/B testing support to compare prompt versions by token usage, latency, and cost
  • Integration with laravel/ai via a HasPromptTemplate trait

Creating and Using Prompts

After installing the package, you can generate a new prompt with the provided make:prompt command:

php artisan make:prompt order-summary

This scaffolds a versioned directory structure under resources/prompts/ that might look like this given the above command:

resources/prompts/
└── order-summary/
├── v1/
│ └── system.md
└── metadata.json

You can then edit the system.md prompt file with {{ $variable }} placeholders for dynamic values:

You are a {{ $tone }} customer service agent.
Summarise the following order: {{ $order }}.

Here's an example of how you can load/render the prompt:

use Veeqtoh\PromptDeck\Facades\PromptDeck;
 
$prompt = PromptDeck::get('order-summary');
$messages = $prompt->toMessages(['tone' => 'friendly', 'order' => $orderDetails]);

The toMessages() method returns a message array compatible with OpenAI, Anthropic, and similar API formats.

To load a specific version:

$prompt = PromptDeck::get('order-summary', 'v2');

You can also activate a version via Artisan without touching code:

php artisan prompt:activate order-summary v2

Laravel AI SDK Integration

For applications using laravel/ai, the HasPromptTemplate trait automatically provides instructions() and promptMessages() on your agent class:

use Veeqtoh\PromptDeck\Concerns\HasPromptTemplate;
 
class OrderAgent extends Agent
{
use HasPromptTemplate;
}

When PROMPTDECK_SCAFFOLD_ON_MAKE_AGENT=true is set in .env, running php artisan make:agent will also scaffold a matching prompt directory automatically.

You can find Prompt Deck on GitHub and read the full documentation at the Prompt Deck docs.

Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Filed in:
Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

image
Tinkerwell

Enjoy coding and debugging in an editor designed for fast feedback and quick iterations. It's like a shell for your application – but with multi-line editing, code completion, and more.

Visit Tinkerwell
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
Acquaint Softtech logo

Acquaint Softtech

Acquaint Softtech offers AI-ready Laravel developers who onboard in 48 hours at $3000/Month with no lengthy sales process and a 100 percent money-back guarantee.

Acquaint Softtech
Laravel Cloud logo

Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Cloud
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
No Compromises logo

No Compromises

Joel and Aaron, the two seasoned devs from the No Compromises podcast, are now available to hire for your Laravel project. ⬧ Flat rate of $9500/mo. ⬧ No lengthy sales process. ⬧ No contracts. ⬧ 100% money back guarantee.

No Compromises
PhpStorm logo

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift

The latest

View all →
Typed Translation Accessors in Laravel 13.15.0 image

Typed Translation Accessors in Laravel 13.15.0

Read article
Refresh Your Laravel Database Without Dropping Every Table image

Refresh Your Laravel Database Without Dropping Every Table

Read article
JSON Schema Deserialization in Laravel 13.14 image

JSON Schema Deserialization in Laravel 13.14

Read article
Generate Short, URL-Safe IDs From Numbers With Sqids image

Generate Short, URL-Safe IDs From Numbers With Sqids

Read article
Scheduler List: A Web Dashboard for Laravel's Scheduled Tasks image

Scheduler List: A Web Dashboard for Laravel's Scheduled Tasks

Read article
Community Laravel Extension for Zed image

Community Laravel Extension for Zed

Read article