developing-with-prism
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
mkdir -p .claude/skills/developing-with-prism && curl -L -o skill.zip "https://mcp.directory/api/skills/download/5285" && unzip -o skill.zip -d .claude/skills/developing-with-prism && rm skill.zipInstalls to .claude/skills/developing-with-prism
About this skill
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
use Prism\Prism\Facades\Prism;
use Prism\Prism\Enums\Provider;
$response = Prism::text()
->using(Provider::Anthropic, 'claude-3-5-sonnet-20241022')
->withSystemPrompt('You are an expert mathematician.')
->withPrompt('Explain the Pythagorean theorem.')
->asText();
echo $response->text;
Structured Output
use Prism\Prism\Facades\Prism;
use Prism\Prism\Enums\Provider;
use Prism\Prism\Schema\ObjectSchema;
use Prism\Prism\Schema\StringSchema;
$schema = new ObjectSchema(
name: 'movie_review',
description: 'A structured movie review',
properties: [
new StringSchema('title', 'The movie title'),
new StringSchema('rating', 'Rating out of 5 stars'),
new StringSchema('summary', 'Brief review summary')
],
requiredFields: ['title', 'rating', 'summary']
);
$response = Prism::structured()
->using(Provider::OpenAI, 'gpt-4o')
->withSchema($schema)
->withPrompt('Review the movie Inception')
->asStructured();
$review = $response->structured;
echo $review['title'];
Streaming (Server-Sent Events)
Route::get('/chat', function () {
return Prism::text()
->using('anthropic', 'claude-3-7-sonnet')
->withPrompt(request('message'))
->asEventStreamResponse();
});
Tools / Function Calling
use Prism\Prism\Facades\Prism;
use Prism\Prism\Tool;
$weatherTool = Tool::as('get_weather')
->for('Get current weather for a location')
->withStringParameter('location', 'The city and state')
->using(fn (string $location): string =>
"Weather in {$location}: 72F, sunny"
);
$response = Prism::text()
->using('anthropic', 'claude-3-5-sonnet-latest')
->withTools([$weatherTool])
->withMaxSteps(3)
->withPrompt('What is the weather in San Francisco?')
->asText();
Multi-Modal (Images/Documents)
use Prism\Prism\ValueObjects\Media\Image;
use Prism\Prism\ValueObjects\Media\Document;
$response = Prism::text()
->using(Provider::Anthropic, 'claude-3-5-sonnet-20241022')
->withPrompt(
'What objects do you see in this image?',
[Image::fromLocalPath('/path/to/image.jpg')]
)
->asText();
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:
glob "src/**/*.php"
grep "class Tool" src/
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:
$response = Prism::text()
->using('anthropic', 'claude-3-7-sonnet-latest')
->withPrompt('Your prompt')
->withProviderOptions(['thinking' => ['enabled' => true]]) // Anthropic-specific
->asText();
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
Wrong Package Name
NEVER use the old package: echolabsdev/prism is deprecated.
ALWAYS use: prism-php/prism
# Correct
composer require prism-php/prism
# Wrong - do not use
composer require echolabsdev/prism
Wrong Namespace
ALWAYS use the Prism\Prism namespace for all Prism classes:
// Correct
use Prism\Prism\Facades\Prism;
use Prism\Prism\Enums\Provider;
use Prism\Prism\Tool;
use Prism\Prism\Schema\ObjectSchema;
// Wrong - these namespaces do not exist
use EchoLabs\Prism\Prism;
use Prism\Facades\Prism;
Decision Workflow
When working with Prism, follow this pattern:
-
Determine what you need:
Text generation? → Use
Prism::text()Structured JSON output? → UsePrism::structured()Embeddings? → UsePrism::embeddings()Image generation? → UsePrism::image()Audio (TTS/STT)? → UsePrism::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
You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
fastapi-templates
wshobson
Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
Related MCP Servers
Browse all serversGet expert React Native software guidance with tools for component analysis, performance, debugging, and migration betwe
Easily convert markdown to PDF using Markitdown MCP server. Supports HTTP, STDIO, and SSE for fast converting markdown t
Uno Platform — Documentation and prompts for building cross-platform .NET apps with a single codebase. Get guides, sampl
The fullstack MCP framework for developing MCP apps for ChatGPT, Claude, and building MCP servers for AI agents. Connect
By Sentry. MCP server and CLI that provides tools for AI agents working on iOS and macOS Xcode projects. Build, test, li
pg-aiguide — Version-aware PostgreSQL docs and best practices tailored for AI coding assistants. Improve queries, migrat
Stay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.