cognesy / instructor-struct
Structured data extraction in PHP, powered by LLMs - core library
v2.3.1
2026-03-30 09:17 UTC
Requires
- php: ^8.3
- cognesy/instructor-config: ^2.3
- cognesy/instructor-events: ^2.3
- cognesy/instructor-logging: ^2.3
- cognesy/instructor-messages: ^2.3
- cognesy/instructor-pipeline: ^2.3
- cognesy/instructor-polyglot: ^2.3
- cognesy/instructor-setup: ^2.3
- cognesy/instructor-telemetry: ^2.3
- cognesy/instructor-templates: ^2.3
- cognesy/instructor-utils: ^2.3
- phpdocumentor/reflection-docblock: ^5.4 || ^6.0
- phpstan/phpdoc-parser: ^1.29
- symfony/property-access: ^7.3 || ^8.0
- symfony/property-info: ^7.3 || ^8.0
- symfony/serializer: ^7.3 || ^8.0
- symfony/validator: ^7.3 || ^8.0
Requires (Dev)
- icanhazstring/composer-unused: ^0.9.0
- jetbrains/phpstorm-attributes: ^1.2
- maglnet/composer-require-checker: ^4.16
- mockery/mockery: ^1.6
- pestphp/pest: ^2.34
- phpstan/phpstan: ^1.11
- roave/security-advisories: dev-latest
- vimeo/psalm: ^6.0
Suggests
- cognesy/instructor-schema: For schema validation and management
This package is auto-updated.
Last update: 2026-05-30 12:14:01 UTC
README
Core structured-output engine for InstructorPHP.
Use it to turn unstructured LLM responses into typed PHP data, with validation, retries, and streaming updates.
Example
<?php use Cognesy\Instructor\StructuredOutput; use Cognesy\Polyglot\Inference\Config\LLMConfig; class Person { public string $name; public int $age; } $person = StructuredOutput::fromConfig(LLMConfig::fromArray(['driver' => 'openai'])) ->with( messages: 'His name is Jason and he is 28 years old.', responseModel: Person::class, ) ->get();
Documentation
packages/instructor/docs/quickstart.mdpackages/instructor/docs/essentials/usage.mdpackages/instructor/docs/_meta.yaml