Quickstart
Start processing your data with LLMs in under 5 minutes
This guide will help you get started with Instructor in your PHP project in under 5 minutes.
For detailed setup instructions, see Setup.
Install Instructor with Composer
Run following command in your terminal:
Create and Run Example
Step 1: Prepare your OpenAI API Key
In this example, we’ll use OpenAI as the LLM provider. You can get it from the OpenAI dashboard.
Step 2: Create a New PHP File
In your project directory, create a new PHP file test-instructor.php
:
You should never put your API keys directly in your real project code to avoid getting them compromised. Set them up in your .env file.
Step 3: Run the Example
Now, you can run the example:
Next Steps
You can start using Instructor in your project right away after installation.
But it’s recommended to publish configuration files and prompt templates to your project directory, so you can customize the library’s behavior and use your own prompt templates.
You should also set up LLM provider API keys in your .env
file instead of putting them directly in your code.
See Setup Instructions for more details.