Download the PHP package token27/nexus-ai-prompts without Composer
On this page you can find all versions of the php package token27/nexus-ai-prompts. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download token27/nexus-ai-prompts
More information about token27/nexus-ai-prompts
Files in token27/nexus-ai-prompts
Package nexus-ai-prompts
Short Description Framework-agnostic prompt registry with Mustache templating, versioning, multi-language fallback, and multi-directory support
License MIT
Homepage https://github.com/token27/nexus-ai-prompts
Informations about the package nexus-ai-prompts
nexus-ai-prompts
A universal, framework-agnostic PHP 8.3+ prompt engine. Manage complex, multimodal, and weighted prompts as versioned resources. Render to any AI provider (OpenAI, Anthropic, Gemini, Stability AI, etc.) with a single fluent API.
Why nexus-ai-prompts?
AI payloads are fragmented. OpenAI wants messages[], Anthropic wants system + messages[], Gemini wants parts[], and Image/Video models want simple strings.
nexus-ai-prompts solves this by:
- Block-based architecture: Prompts are collections of flexible blocks, not just chat roles.
- Provider-agnostic core: Render once, format for any API (8 built-in formatters).
- First-class versioning: Ship
v1.0.0today, testv2.0.0tomorrow, rollback instantly. - Multi-language cascade: Automatic fallback from
es_AR→es→en. - Fluent API: Entry points for every workflow — from static one-liners to complex builders.
Features
- Universal Prompt Storage: JSON-based prompts with
meta,blocks, andvariables. - 8 Output Formatters: OpenAI, Anthropic, Gemini, PlainString, Completion, Stability AI, Ollama, Embedding.
- Mustache Templating: Full logic support (
{{variable}},{{#section}}) with strict variable validation. latestversion resolution: Always resolve to the highest semantic version automatically.- Discovery:
autoloadFrom()registers whole libraries;PromptFinder::scan()discovers prompts on disk. - Zero Config Raw Prompts: Render dynamic templates on-the-fly via
PromptEngine::raw(). - Type Safety: PHPStan Level 8, production-grade architecture.
Installation
Requires: PHP 8.3+ · mustache/mustache ^2.14 · league/flysystem ^3.0
Quick Start
1. Static One-Liners (No Registry)
2. Fluent Builder
3. Versioned Registry (JSON Files)
File: resources/prompts/article/research/v1.0.0/en.json
Usage:
Documentation
- Prompt Format — The new
blocksschema - Fluent API (Engine & Builder) — Create prompts on-the-fly
- Output Formatters — OpenAI, Anthropic, Gemini, etc.
- Registry & Resolution — Loading versioned prompts
- Language Fallback — How the cascade works
- Multi-Source — handling name collisions
- PromptFinder — zero-config discovery
- Advanced Integration — Ecosystem usage and Custom formatters
- Architecture — How the blocks system works
- Internal Logic & Diagrams — Sequence diagrams and deep-dives
- Testing — How to test your prompts
- Troubleshooting — Exceptions, errors and common solutions
License
MIT. See LICENSE.