curly-deni / laravel-prompts
Prompt rendering infrastructure for Laravel applications.
Requires
- php: ^8.4
- illuminate/contracts: ^13.0
- illuminate/support: ^13.0
- illuminate/view: ^13.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.8
- orchestra/testbench: ^11.0.0
- pestphp/pest: ^4.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan-deprecation-rules: ^2.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Versioned Markdown Blade prompt templates for Laravel applications.
Installation
composer require curly-deni/laravel-prompts
Laravel discovers the service provider automatically. Publish the config when you need to customize the prompt directory or active versions:
php artisan vendor:publish --tag=laravel-prompts-config
By default templates are read from resources/prompts. Organize them under
layouts and parts, using the logical name and version in each filename:
resources/prompts/
├── layouts/welcome/greeting_v2.md.blade.php
└── parts/shared/signature_v1.md.blade.php
Set active versions in config/prompts.php. Names can be dot-separated keys or
nested arrays:
'layouts' => [ 'welcome.greeting' => 2, ], 'parts' => [ 'shared.signature' => 1, ],
Usage
Render a full prompt and pass data to its Blade template:
use Aesis\Prompts\Services\PromptService; $prompt = app(PromptService::class)->renderPrompt('welcome.greeting', [ 'name' => 'Ada', ]);
Render a reusable part from a Blade view:
@prompt('shared.signature')
You can select a part version explicitly with renderPart('shared.signature', 2)
or @prompt('shared.signature', 2). Template names accept letters, numbers,
underscores, and hyphens in each dot-separated segment.
Development
composer test
composer format
composer analyse
License
MIT. See LICENSE.md.