Installation
LLM Magic is a Laravel package that can be installed via Composer. Follow these steps to get started.Requirements
Before installing LLM Magic, ensure your environment meets these requirements:- PHP: 8.3 or higher
- Laravel: Any version (compatible with Laravel’s latest releases)
- Extensions:
ext-fileinfo(typically included by default)
LLM Magic requires PHP 8.3+ to take advantage of modern PHP features and type safety.
Install via Composer
Install the package
Run the following command in your Laravel project directory:This will install LLM Magic and all its dependencies.
Publish the configuration file
After installation, publish the configuration file to customize settings:This creates a
config/llm-magic.php file in your Laravel application.Configure API keys
Add your LLM provider API keys to your
.env file:You only need to configure the API keys for the providers you plan to use. OpenAI is the default provider.
Dependencies
LLM Magic automatically installs the following key dependencies:- openai-php/client: OpenAI API client
- google-gemini-php/client: Google Gemini API client
- prism-php/prism: Multi-provider LLM abstraction layer
- spatie/laravel-package-tools: Laravel package utilities
- phpoffice/phpword: Word document processing
- spatie/pdf-to-image: PDF processing capabilities
Next Steps
Now that you have LLM Magic installed, continue to the Quick Start guide to learn how to use it:Quick Start Guide
Learn how to make your first LLM requests with Magic::ask() and Magic::chat()