https://github.com/promptphp/deck
A Laravel package for versioned AI prompt management with variable interpolation, performance tracking & A/B testing.
https://github.com/promptphp/deck
ai larvel php prompt prompt-engineering
Last synced: about 15 hours ago
JSON representation
A Laravel package for versioned AI prompt management with variable interpolation, performance tracking & A/B testing.
- Host: GitHub
- URL: https://github.com/promptphp/deck
- Owner: promptphp
- License: mit
- Created: 2026-02-27T23:09:48.000Z (4 months ago)
- Default Branch: 0.x
- Last Pushed: 2026-06-24T22:09:47.000Z (15 days ago)
- Last Synced: 2026-07-02T04:20:02.829Z (7 days ago)
- Topics: ai, larvel, php, prompt, prompt-engineering
- Language: PHP
- Homepage: https://deck.promptphp.com/
- Size: 768 KB
- Stars: 98
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: docs/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Codeowners: .github/CODEOWNERS
- Agents: docs/AGENTS.md
Awesome Lists containing this project
- awesome-php-ai - Prompt Deck
README

## Introduction
Deck, formerly Prompt Deck, provides AI prompt management for Laravel and PHP.
Organise your AI agent instructions as versioned files, compare prompt performance, and activate the right version across your app with variable interpolation, tracking, A/B testing, and Laravel AI SDK integration.
> [!IMPORTANT]
> Prompt Deck is now **Deck by PromptPHP**.
>
> From `v0.4.0`, the package moved from `veeqtoh/prompt-deck` to `promptphp/deck`, and the namespace changed from `Veeqtoh\PromptDeck` to `PromptPHP\Deck`.
>
> Upgrading from `v0.3.x`? See the [upgrade guide](UPGRADE.md).
## Quick Start
### Installation
```bash
composer require promptphp/deck
```
Publish the config and migrations
```bash
php artisan vendor:publish --provider="PromptPHP\Deck\Providers\DeckServiceProvider"
# Run migrations.
php artisan migrate
```
### Creating a Prompt
Use the Artisan command to create a versioned prompt
```bash
php artisan make:prompt order-summary
```
This creates the following structure
```txt
resources/prompts/order-summary/
├── metadata.json
├── v1/
│ ├── system.md
│ └── user.md
└── v2/
├── system.md
└── user.md
```
Edit `resources/prompts/order-summary/v1/system.md` with your prompt content. Use `{{ $variable }}` syntax for dynamic values:
```markdown
You are a {{ $tone }} customer service agent.
Summarise the following order for the customer: {{ $order }}.
```
### Using a Prompt
Load and render prompts with the `Deck` facade
```php
use PromptPHP\Deck\Facades\Deck;
// Load the active version of a prompt.
$prompt = Deck::get('order-summary');
// Render a role with variables.
$prompt->system(['tone' => 'friendly', 'order' => $orderDetails]);
// "You are a friendly customer service agent. Summarise the following order..."
// Build a messages array ready for any chat-completion API.
$messages = $prompt->toMessages(['tone' => 'friendly', 'order' => $orderDetails]);
// [['role' => 'system', 'content' => '...']]
```
### Versioning
Create a new version of an existing prompt
```bash
php artisan make:prompt order-summary
# Automatically creates v2, v3, etc.
```
Activate a specific version
```bash
php artisan prompt:activate order-summary v2
# or
php artisan prompt:activate order-summary 2
```
Or load a specific version programmatically
```php
$prompt = Deck::get('order-summary', 'v2');
```
### Laravel AI SDK Integration
If you use the [Laravel AI SDK](https://laravel.com/docs/ai-sdk), add the `HasPromptTemplate` trait to your agents. This way, you do not need to define the `instructions()` method as it is provided automatically.
```php
use PromptPHP\Deck\Concerns\HasPromptTemplate;
class OrderAgent extends Agent
{
use HasPromptTemplate;
// instructions() and promptMessages() are provided automatically.
}
```
Running `make:agent` will also auto-scaffold a matching prompt directory.
For the complete guide, see the [full documentation](#documentation) below.
---
## Documentation
Full documentation can be found at [https://deck.promptphp.com/](https://deck.promptphp.com/) or the [docs](docs/) directory on GitHub.
## Contributing
Thank you for considering contributing to Deck by PromptPHP. Please open an issue or submit a pull request on [GitHub](https://github.com/promptphp/deck).
## Code of Conduct
We follow the Laravel [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct). We expect you to abide by these guidelines as well.
## Security Vulnerabilities
If you discover a security vulnerability within Deck by PromptPHP, please email Victor Ukam at [victorjohnukam@gmail.com](victorjohnukam@gmail.com). All security vulnerabilities will be addressed promptly.
## License
Deck by PromptPHP is open-sourced software licensed under the [MIT license](LICENSE).
## Support
This library is created by [Victor Ukam](https://victorukam.com) with contributions from the [Open Source Community](https://github.com/promptphp/deck/graphs/contributors). If you've found this package useful, please consider [sponsoring this project](https://github.com/sponsors/veeqtoh). It will go a long way to help with maintenance.