Download the PHP package kent013/laravel-prism-prompt without Composer

On this page you can find all versions of the php package kent013/laravel-prism-prompt. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-prism-prompt

Laravel Prism Prompt

Laravel Mailable-like API for LLM prompts with Prism.

Define your prompts as YAML templates + PHP classes. Move text and model settings out of code, separate the system message from the user message, parse responses into typed DTOs, and observe every call via events with USD cost attached — the same way you'd compose a Mailable.

That's the whole loop. Everything else in this package is a layer on top: DTO mapping, multi-provider fallback, prompt-injection defence, parallel execution with prompt caching, observability, durable operations.

Installation

Publish config:

At a glance

Need Approach Doc Example
One-shot prompt with a YAML file Prompt::load('name', $vars)->executeSync() yaml-template 01
Typed DTO response (legacy / text JSON) Subclass + parseResponse() + extractJson() yaml-template 02
Schema-enforced DTO response (recommended) Subclass + getJsonSchema() + parseStructured() structured-output 13
Send chat history natively Override buildConversationMessages() yaml-template 03
Defend against prompt injection UserInput::from() + DefensiveInstructions prompt-injection 06
Multi-provider fallback (BYOK) YAML models[] + withApiKeys() providers 08
Parallel batch with shared cache PromptPool::executeWithWarmup() parallel-execution 09
Prompt caching on a single executeSync() sections: + withCacheBreakpoints() parallel-execution
Embeddings for RAG EmbeddingPrompt embedding 10
Chat assistant w/ history + defence Combine UserInput + history override + DTO prompt-injection 11
Multi-prompt pipeline (NPC reply → eval → hint) Chain Prompt subclasses yaml-template 12
Cost / usage / audit trail Listen to PromptExecutionCompleted + withMetadata() events-and-cost 05
Cost / usage for pooled calls PromptPool::executeWithWarmup() + $prompt->getPoolCallMeta() parallel-execution 09
Durable, resumable LLM operation PromptOperation::for()->claimOrFollow() prompt-operation 07
Test mocked LLM calls Prompt::fake() + assertions testing 04
Listener-based debug logs PRISM_PROMPT_DEBUG=true debug-logging

Settings priority

Settings resolve highest-wins:

  1. Class property (e.g. protected ?float $temperature = 0.5)
  2. YAML field
  3. Config default (config('prism-prompt.default_*'))

Subclassing

Use Prompt::load() for the simplest case. When you need typed DTOs, custom message construction, or fluent variables in __construct, subclass:

Structured output (recommended for new code, since v0.15.0)

For prompts whose output must conform to a fixed shape, declare a Prism schema via getJsonSchema(). The base will route the call through Prism::structured() and pass the decoded array straight to parseStructured() — no extractJson() regex, no YAML JSON example to drift out of sync.

getJsonSchema() returning null (the default) keeps the legacy Prism::text() + extractJson() path, so existing subclasses continue to work unchanged. See docs/structured-output.md for the full contract (event payload, fakes, error handling).

YAML lookup (in priority order):

  1. $promptName property — relative path from prompts_path
  2. Naming convention — GreetingPromptgreeting.yaml
  3. $promptsDirectory — group prompts under a subdirectory

getTemplatePath() is overridable for full control.

Configuration reference

config/prism-prompt.php

Key Default Description
default_provider anthropic Default LLM provider for text generation
default_model claude-sonnet-4-5-20250929 Default model for text generation
default_max_tokens 4096 Maximum tokens in LLM response
default_temperature 0.7 Response randomness (0.0 - 1.0)
default_embedding_provider openai Default provider for embeddings
default_embedding_model text-embedding-3-small Default model for embeddings
prompts_path resource_path('prompts') Base path for YAML templates
cache.enabled true Enable YAML template caching
cache.ttl 3600 Cache TTL in seconds
cache.store null Cache store (null = default)
pool.concurrency 5 Default PromptPool concurrency (env PRISM_PROMPT_POOL_CONCURRENCY)
debug.enabled false Auto-register PerformanceLogListener
debug.log_channel prism-prompt Log channel for debug output
debug.save_files false Auto-register PerformanceDebugFileListener
debug.storage_path storage_path('prism-prompt-debug') Directory for debug files

config/prism-prompt-pricing.php

Key Default Description
pricing_source defaults_shipped Label embedded in every PricingSnapshot. Override via PRISM_PROMPT_PRICING_SOURCE
unknown_model_behavior zero zero returns a zero-cost snapshot; throw raises InvalidArgumentException
models.{provider}.{model} Anthropic Claude set Per-million-token rates: input, output, optional cache_write / cache_read

Documentation

In-depth topic guides live under docs/:

Runnable examples are under examples/:

File Topic
01-basic-system-prompt.php Quickest path with Prompt::load()
02-json-dto-response.php Subclass + extractJson() → DTO (legacy text path)
13-structured-output.php Subclass + getJsonSchema() → DTO (Prism::structured, v0.15.0+)
03-conversation-history.php Native chat history via buildConversationMessages()
04-testing.php Message-aware Prompt::fake() assertions
05-events-and-cost.php PromptExecutionCompleted listener + cost log
06-user-input-defense.php UserInput + DefensiveInstructions
07-prompt-operation.php PromptOperation durable workflow
08-multi-provider-fallback.php BYOK with auto provider selection
09-prompt-pool-parallel.php 5-axis rubric grading via PromptPool
10-embedding-rag.php RAG document indexing with EmbeddingPrompt
11-chatbot-with-defense.php Chatbot combining history + UserInput + DTO
12-bundle-pipeline.php Multi-prompt pipeline (NPC reply → eval → hint)

License

MIT


All versions of laravel-prism-prompt with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
echolabsdev/prism Version ^0.10|^0.99|^0.100|^1.0
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
illuminate/view Version ^10.0|^11.0|^12.0|^13.0
react/async Version ^4.3
symfony/yaml Version ^6.0|^7.0|^8.0
webmozart/assert Version ^1.11|^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package kent013/laravel-prism-prompt contains the following files

Loading the files please wait ...