prism-php/prism/developing-with-prism
- community
Checking that the SKILL.md file is still in the repository.
Guide for developing with Prism PHP package - a Laravel package for integrating LLMs. Activate or use when working with Prism features including text generation, structured output, embeddings, image generation, audio processing, streaming, tools/function calling, or any LLM provider integration (OpenAI, Anthropic, Gemini, Mistral, Groq, XAI, DeepSeek, OpenRouter, Ollama, VoyageAI, ElevenLabs). Activate for any Prism-related development tasks.
Install
npx vskill@latest install prism-php/prism/developing-with-prismSKILL.md
Developing with Prism
Prism is a Laravel package for integrating Large Language Models (LLMs) into applications with a fluent, expressive and eloquent API.
Basic Usage Examples
Text Generation
Structured Output
Streaming (Server-Sent Events)
Tools / Function Calling
Multi-Modal (Images/Documents)
Prism Documentation
IMPORTANT: Always search the docs before implementing Prism features.
How to Search
- Read a specific doc file directly:
`` read vendor/prism-php/prism/docs/core-concepts/text-generation.md read vendor/prism-php/prism/docs/providers/openai.md ``
- Search for a topic across docs:
`` grep "streaming" vendor/prism-php/prism/docs/ grep "withProviderOptions" vendor/prism-php/prism/docs/providers/ ``
- Find all doc files:
`` glob "vendor/prism-php/prism/docs/**/*.md" ``
Documentation Paths
| Need | Read This File | |
|---|---|---|
| Text generation | docs/core-concepts/text-generation.md | |
| Streaming responses | docs/core-concepts/streaming-output.md | |
| Tools / function calling | docs/core-concepts/tools-function-calling.md | |
| Structured JSON output | docs/core-concepts/structured-output.md | |
| Embeddings | docs/core-concepts/embeddings.md | |
| Image generation | docs/core-concepts/image-generation.md | |
| Audio (TTS/STT) | docs/core-concepts/audio.md | |
| Schema definitions | docs/core-concepts/schemas.md | |
| Testing | docs/core-concepts/testing.md | |
| Image input | docs/input-modalities/images.md | |
| Document input (PDF) | docs/input-modalities/documents.md | |
| OpenAI options | docs/providers/openai.md | |
| Anthropic options | docs/providers/anthropic.md | |
| Other providers | docs/providers/{provider}.md | |
| Error handling | docs/advanced/error-handling.md |
Source Code Reference
For implementation details:
Key Patterns
- Use
Prism\Prism\Facades\Prismfacade orprism()helper - Core methods:
Prism::text(),Prism::structured(),Prism::embeddings(),Prism::image(),Prism::audio() - Chain
->using(Provider::Name, 'model-id')to specify provider/model - Finalize with:
->asText(),->asStructured(),->asStream(),->asEventStreamResponse(),->asDataStreamResponse()
Provider-Specific Options
Use ->withProviderOptions([...]) to pass provider-specific features:
Always search the provider docs first to find available options for each provider:
docs/providers/openai.md- strict mode, reasoning, image generation optionsdocs/providers/anthropic.md- thinking mode, prompt caching, citationsdocs/providers/gemini.md,docs/providers/mistral.md, etc.
Common Pitfalls
Continuing Conversations
Pass $response->messages back with withMessages() to continue a conversation, and persist each message's additionalContent when storing it. Rebuilding AssistantMessages from $response->text drops the thinking blocks and reasoning items that current Claude and OpenAI models expect back. For streamed responses, build the messages with StreamedMessages::fromEvents($events) inside the streaming callback. See docs/core-concepts/text-generation.md and docs/core-concepts/streaming-output.md.
Check the Finish Reason
Refusals return a normal response with FinishReason::Refusal rather than throwing, and structured output is empty in that case. Check $response->finishReason before using $response->text or $response->structured.
Current Model Parameters
- Claude 5.x models reject
['thinking' => ['enabled' => true, 'budgetTokens' => ...]]. Use['thinking' => ['type' => 'adaptive']]witheffort. - Claude 5.x and GPT-6.x / GPT-5.5+ reject non-default
temperatureandtop_p(OpenAI accepts them only with reasoning effortnone). Don't callusingTemperature()/usingTopP()for these models. - For Anthropic structured output on Claude Opus 5.5, Sonnet 5.5 and Fable 5.1, keep the default native mode;
use_tool_callingforces a tool choice those models reject.
Wrong Package Name
NEVER use the old package: echolabsdev/prism is deprecated.
ALWAYS use: prism-php/prism
Wrong Namespace
ALWAYS use the `Prism\Prism` namespace for all Prism classes:
Decision Workflow
When working with Prism, follow this pattern:
- Determine what you need:
Text generation? → Use Prism::text() Structured JSON output? → Use Prism::structured() Embeddings? → Use Prism::embeddings() Image generation? → Use Prism::image() Audio (TTS/STT)? → Use Prism::audio()
- Always read the relevant docs first before implementing.
Related Packages
- Prism Relay - MCP tools integration for Prism. See
references/relay.md - Prism Bedrock - AWS Bedrock provider: https://github.com/prism-php/bedrock
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingresources/boost/skills/developing-with-prism/SKILL.md
Popularity
- Repository stars
- 2,329
- Repository forks
- 278
- 7-day trend score
- 39
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 19 Mar 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/prism-php/prism/developing-with-prism)