Artisan Commands
The package registers three Artisan commands to help with installation, testing, and scaffolding. All commands are registered automatically when the application is running in console mode.instructor:install
Sets up the Instructor package in your Laravel application. This is the recommended first step after installing the Composer package.What It Does
- Publishes the configuration file (
config/instructor.php) using theinstructor-configpublish tag - Checks for API key configuration by scanning your
.envfile forOPENAI_API_KEYorANTHROPIC_API_KEYentries - Displays next steps including how to create your first response model and test the installation
Options
Example Output
instructor:test
Tests your Instructor installation and API configuration by making a real API call. This verifies that your API key is valid, the network connection works, and the full extraction pipeline (or raw inference pipeline) is operational.What It Does
- Displays current configuration — connection name, driver, model, and a masked version of the API key
- Makes a test API call — either a structured output extraction (default) or a raw inference call
- Verifies the response — confirms the result contains the expected data
Options
Examples
Example Output
-v flag for verbose output, which includes a full stack trace if the test fails.
make:response-model
Generates a new response model class with typed constructor properties, docblock descriptions, and the correct namespace. The generated class is ready to use withStructuredOutput::with(responseModel: ...) immediately.
Arguments
Options
Examples
Basic Response Model
app/ResponseModels/PersonData.php:
Collection Response Model
Nested Objects Response Model
With Description
Customizing Stubs
Publish the stubs to customize the templates used bymake:response-model:
stubs/instructor/ in your application root: