Artisan Commands
The package provides several Artisan commands to help with development and testing.instructor:install
Installs and configures the Instructor package.What It Does
- Publishes the configuration file (
config/instructor.php) - Checks for API key configuration in
.env - Shows next steps for getting started
Options
| Option | Description |
|---|---|
--force | Overwrite existing configuration files |
Example Output
instructor:test
Tests your Instructor installation and API configuration.What It Does
- Displays current configuration
- Makes a test API call
- Verifies the response
Options
| Option | Description |
|---|---|
--preset= | Test a specific connection preset |
--inference | Test raw inference instead of structured output |
Examples
Example Output
make:response-model
Generates a new response model class.Arguments
| Argument | Description |
|---|---|
name | The name of the response model class |
Options
| Option | Description |
|---|---|
--collection, -c | Create a collection response model |
--nested, -n | Create a nested objects response model |
--description=, -d | Set the class description |
--force, -f | Overwrite existing file |
Examples
Basic Response Model
app/ResponseModels/PersonData.php:
Collection Response Model
Nested Objects Response Model
With Description
Customizing Stubs
Publish the stubs to customize them:stubs/instructor/:
Stub Placeholders
| Placeholder | Description |
|---|---|
{{ namespace }} | The class namespace |
{{ class }} | The class name |
{{ description }} | The class description |
Creating Custom Commands
Extend the package commands for your specific needs:Command Reference
| Command | Description |
|---|---|
instructor:install | Install and configure the package |
instructor:test | Test API configuration |
make:response-model | Generate a response model class |