Skip to main content

Getting Started

Your First Prompt

Extend Prompt and implement body(). That’s it.
Render it:

Creating Instances

There are two static constructors:

Passing Context

Context is passed as named arguments. Pre-bound context from with() merges with context passed to render(), with render-time values taking precedence:

Stringable

Every prompt implements Stringable, so you can use it anywhere PHP accepts a string:

Returning Null

A body() that returns null renders as an empty string. This is intentional — it enables conditional composition, which is covered in Composition.

Next Steps

  • Composition — combine prompts into larger structures
  • Templates — use Twig files for complex prompt content