lvlup-dev/laravel-agent-editable-prompts
Composer 安装命令:
composer require lvlup-dev/laravel-agent-editable-prompts
包简介
Store agent prompts in the database, resolve concatenated text by agent slug, and ship optional Inertia + Vue CRUD pages.
README 文档
README
Store LLM / agent prompts in the database, group them by agent_slug, order them with priority, and resolve them at runtime as ordered segments or a single concatenated string. Optionally register an Inertia + Vue CRUD so non-developers can edit prompts without deploys.
Requires inertiajs/inertia-laravel (and a Vue/React frontend) if you use the bundled admin UI.
Quick example
use LvlupDev\AgentEditablePrompts\Services\AgentPromptService; // Single string: all rows for this slug, sorted by priority, joined with the configured separator $instructions = app(AgentPromptService::class)->resolve('my-agent'); // Ordered Eloquent models (e.g. Blade::render per row in your app) $chunks = app(AgentPromptService::class)->segments('my-agent');
Installation
1. Composer
composer require lvlup-dev/laravel-agent-editable-prompts
Laravel auto-discovers AgentEditablePromptsServiceProvider (see composer.json → extra.laravel.providers).
2. Migrations
The package loads its migration automatically. Create the table:
php artisan migrate
Default table name: agent_editable_prompts. Override with AGENT_EDITABLE_PROMPTS_TABLE (see below) if needed.
3. Configuration (recommended)
Publish the config file so you can tune behaviour and .env overrides in one place:
php artisan vendor:publish --tag=agent-editable-prompts-config
This copies config/agent-editable-prompts.php into your application. Until you publish, merged defaults from the package still apply.
4. Inertia / Vue pages (if you use the bundled CRUD)
The HTTP controllers render Inertia pages under Vendor/AgentPrompts/*. Those components must exist in your app (Vite only bundles your resources/js tree).
Publish the starter pages:
php artisan vendor:publish --tag=agent-prompts-vue
Then adapt them to your layout (e.g. wrap with your admin shell), run your frontend build, and ensure Wayfinder or your route helpers know the package routes if you link from the sidebar.
If you do not want the package routes at all, set AGENT_EDITABLE_PROMPTS_REGISTER_ROUTES=false and build your own controllers/UI while still using AgentPrompt + AgentPromptService.
5. Environment variables
All keys are optional; defaults match config/agent-editable-prompts.php.
| Variable | Default (if unset) | Role |
|---|---|---|
AGENT_EDITABLE_PROMPTS_TABLE |
agent_editable_prompts |
Database table name. |
AGENT_EDITABLE_PROMPTS_SEPARATOR |
\n\n |
Separator used by AgentPromptService::resolve(). |
AGENT_EDITABLE_PROMPTS_PRIORITY_SORT |
asc |
asc or desc — order of priority when resolving. |
AGENT_EDITABLE_PROMPTS_REGISTER_ROUTES |
true |
Set to false to disable the Inertia CRUD routes entirely. |
AGENT_EDITABLE_PROMPTS_MIDDLEWARE |
web |
Comma-separated middleware list for the CRUD routes. Include web when using Inertia (session, cookies, CSRF). Example: web,auth or web,auth,admin. |
AGENT_EDITABLE_PROMPTS_ROUTE_PREFIX |
(empty) | URL prefix (no leading slash required; it is trimmed). Example: admin → /admin/agent-editable-prompts. |
AGENT_EDITABLE_PROMPTS_ROUTE_NAME_PREFIX |
(empty) | Prepended to route names. Example: admin. → admin.agent-editable-prompts.index. |
Important: routes registered by the package are not defined in your routes/web.php; they only receive the middleware you list in AGENT_EDITABLE_PROMPTS_MIDDLEWARE. For a typical Inertia app, use at least web,auth (and your admin gate if you have one).
Usage
Model
LvlupDev\AgentEditablePrompts\Models\AgentPrompt uses the configured table and fillable fields:
agent_slug— logical agent (e.g.support-bot,onboarding)name— human label in the UIcontent— prompt body (your app may treat it as Blade, Markdown, etc.)priority— integer; lower values sort first whenpriority_sort_directionisasc
Service
AgentPromptService is registered as a singleton:
$service = app(\LvlupDev\AgentEditablePrompts\Services\AgentPromptService::class); $service->segments('my-agent'); // Collection of AgentPrompt models $service->resolve('my-agent'); // string
HTTP routes (when enabled)
Resource basename: agent-editable-prompts.
Route parameter name: agent_prompt.
Default route names (no AGENT_EDITABLE_PROMPTS_ROUTE_NAME_PREFIX):
agent-editable-prompts.indexagent-editable-prompts.createagent-editable-prompts.storeagent-editable-prompts.editagent-editable-prompts.updateagent-editable-prompts.destroy
AgentPromptService::routeName('index') respects the configured name prefix.
Scope and alternatives
This package is intentionally focused: one table, slug + priority, optional generic CRUD. It does not ship authorization policies, prompt versioning, A/B testing, or provider-specific prompt formats.
For richer CMS-style content or team workflows, consider integrating a headless CMS, a dedicated prompts product, or your own tables and UI on top of the same ideas.
Credits
laravel-agent-editable-prompts is built and maintained by LVLUP. We help businesses drive operational efficiency through strategic consulting, tailored software development, and advanced AI agent integrations.
License
The MIT License (MIT). Please see LICENSE for more information.
lvlup-dev/laravel-agent-editable-prompts 适用场景与选型建议
lvlup-dev/laravel-agent-editable-prompts 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 03 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「Agent」 「ai」 「vue」 「inertia」 「prompts」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 lvlup-dev/laravel-agent-editable-prompts 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 lvlup-dev/laravel-agent-editable-prompts 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 lvlup-dev/laravel-agent-editable-prompts 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A component that allows creating responsive HTML tables or lists from data object
Custom laravel monolog logger for datadog logs management, both api and agent ways
Admin panel generator for Laravel 8 and based on Vuetify Admin, a separate SPA admin framework running on top of REST APIs.
The Message Submission Agent Diagnostics tool (msadiag) facilitates testing the compatibility of third party message submission agents.
Code generation for MPMG projects that use Laravel and VueJs tecnologies.
Standalone replacement for php's native get_browser() function
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 30
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-29