cognesy/instructor-laravel

Laravel integration for Instructor PHP - Structured LLM outputs made simple

Maintainers

Package info

github.com/cognesy/instructor-laravel

pkg:composer/cognesy/instructor-laravel

Statistics

Installs: 47

Dependents: 0

Suggesters: 1

Stars: 0

Open Issues: 0

v2.2.0 2026-03-18 23:35 UTC

This package is auto-updated.

Last update: 2026-03-19 13:24:28 UTC


README

Laravel integration for InstructorPHP.

It provides:

  • Laravel service provider and config
  • Facades for StructuredOutput, Inference, Embeddings, and AgentCtrl
  • Laravel-specific HTTP client and HTTP pool drivers
  • a Laravel-bound CanSendHttpRequests transport implementation
  • native Cognesy\Agents container bindings, registry loading, and session runtime
  • database-backed native agent sessions, broadcasting helpers, telemetry wiring, and logging presets
  • testing fakes for facade-based tests and Laravel-native helper utilities for native agents
  • Artisan commands for install, smoke-test, and response-model scaffolding

The package now treats native Cognesy\\Agents runtime configuration and AgentCtrl code-agent execution as separate Laravel surfaces:

  • agents is reserved for native agent runtime integration
  • agent_ctrl configures CLI code agents exposed through the AgentCtrl facade
  • telemetry is the first-class config namespace for Laravel telemetry wiring

Example

<?php

use App\ResponseModels\PersonData;
use Cognesy\Instructor\Laravel\Facades\StructuredOutput;

$person = StructuredOutput::with(
    messages: 'John Smith is 30 years old',
    responseModel: PersonData::class,
)->get();

Documentation

  • packages/laravel/docs/index.md
  • packages/laravel/CHEATSHEET.md