Release Notes v1.14.0
New Package: instructor-laravel
Laravel Integration Package (packages/laravel/)
A dedicated package providing first-class Laravel integration for Instructor PHP:
Facades
Four main facades for interacting with LLMs and code agents:StructuredOutput::- Extract structured data from text with validation and retriesInference::- Raw LLM inference without structured output constraintsEmbeddings::- Generate text embeddings for vector operationsAgentCtrl::- Invoke CLI-based code agents (Claude Code, Codex, OpenCode)
Testing Fakes
Laravel-style testing doubles with::fake() pattern:
StructuredOutput::fake()- Mock structured output responsesInference::fake()- Mock inference responses with pattern matchingEmbeddings::fake()- Mock embedding vectorsAgentCtrl::fake()- Mock code agent executions
Laravel HTTP Client Integration
Uses Laravel’sHttp:: client internally, enabling:
- Full compatibility with
Http::fake()in tests - Request/response logging through Laravel’s HTTP middleware
- Automatic retry handling via Laravel’s HTTP client features
Event Bridge
Instructor events are automatically dispatched to Laravel’s event system:Artisan Commands
php artisan instructor:install- Publish configuration and setupphp artisan instructor:test- Test your API configurationphp artisan make:response-model- Generate response model classes
Configuration
Laravel-style configuration with environment variables:New Feature: AgentCtrl Facade
Unified API for Controlling Agents TheAgentCtrl facade provides access to CLI-based code agents that can execute code, modify files, and perform complex tasks:
Supported Agents
| Agent | Description |
|---|---|
| Claude Code | Anthropic’s Claude agent with code execution |
| Codex | OpenAI’s Codex agent |
| OpenCode | Multi-model code agent with provider flexibility |
Usage
Streaming Support
Session Management
Testing
Sandbox Drivers
Control agent execution isolation:| Driver | Description |
|---|---|
host | Direct execution (development) |
docker | Docker container isolation |
podman | Rootless container isolation |
firejail | Linux sandbox |
bubblewrap | Minimal sandbox (CI/CD) |
Installation
.env:
Migration Notes
For Existing Instructor Users
The Laravel package is additive - no changes required to existing code. You can:- Continue using Instructor directly via dependency injection
- Adopt facades gradually where convenient
- Use
::fake()pattern for new tests
Recommended Adoption Path
- Install the package
- Replace
Http::fake()based tests withStructuredOutput::fake() - Adopt facades in new code for cleaner syntax
- Migrate existing DI usage to facades where appropriate
Key Benefits
- Laravel Integration: Facades, fakes, and configuration follow Laravel conventions
- Testing:
::fake()pattern with comprehensive assertions - Zero Configuration: Works out of the box with sensible defaults
- Event Integration: Full visibility into Instructor operations via Laravel events
- Code Agents: Access powerful CLI agents directly from your Laravel application