GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Instructor for PHP home page
  • Issues
  • Github
  • Packages
  • Cookbook
  • Cheatsheets
  • Features
  • Getting started
  • Use cases
  • Why instructor
  • Versions
  • V2.14.2
  • V2.14.1
  • V2.14.0

This view

  • Original page
  • New address

GeezerVison is showing docs.instructorphp.com — Index - Instructor for PHP

​
Instructor for PHP

InstructorPHP is a modular AI toolkit for PHP 8.3 and later. Use a package on its own or combine packages according to your application’s needs.

​
Choose a package

  • Polyglot provides LLM inference, embeddings, streaming, and typed decision models through a shared PHP API.
  • Instructor extracts validated PHP objects from LLM responses.
  • Agents provides an agent loop with tools, state, and execution controls.
  • AgentCtrl orchestrates coding-agent CLIs from PHP.
Install the complete toolkit:
composer require cognesy/instructor-php
For structured extraction alone, install cognesy/instructor-struct. See the Instructor quickstart for the standalone setup.

​
First structured extraction

Set OPENAI_API_KEY in your environment, then run:
<?php
require __DIR__ . '/vendor/autoload.php';

use Cognesy\Instructor\StructuredOutput;

class Person {
    public string $name;
    public int $age;
}

$person = StructuredOutput::using('openai')
    ->with(
        messages: 'Jason is 28 years old.',
        responseModel: Person::class,
    )
    ->get();

echo $person->name;
echo $person->age;
Credentials and model availability depend on your provider. Keep secrets outside source code and check the documentation for the version installed by Composer.

​
Documentation and community

  • Canonical documentation: Package guides and API usage.
  • Agent starting guide: A concise guide to useful Markdown pages.
  • Complete Markdown catalog: All generated documentation links.
  • Articles: Tutorials and implementation guidance.
  • GitHub: Source, issues, discussions, and releases.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.