Requirements
Before installing AI Translations for Laravel, ensure your project meets these requirements:- PHP 8.1 or higher
- Laravel 10.x or 11.x
- An API key for your preferred LLM provider (Anthropic, OpenAI, or Google Gemini)
Install via Composer
Install the package using Composer:Publish configuration
Publish the configuration file to customize the package settings:config/ai-translations.php file in your Laravel application.
Configure your LLM provider
The package supports multiple LLM providers through theneuron-ai library. You need to configure at least one provider to use the translation features.
Choose a provider
The package supports the following providers:- Anthropic (Claude) - Recommended for best quality
- OpenAI (GPT)
- Google Gemini
Set your provider in config
Openconfig/ai-translations.php and set your preferred provider:
config/ai-translations.php
Add API keys to your environment
Add your API key to your.env file based on your chosen provider:
The
fast_model configuration is used when you run translation commands with the --fast flag for quicker (but potentially less accurate) translations.Configure languages
By default, the package automatically detects languages from yourlang directory. You can also specify languages manually in the configuration file:
config/ai-translations.php
Verify installation
Verify the package is installed correctly by running:Next steps
Now that you’ve installed and configured the package, you’re ready to start translating your language files.Quickstart guide
Learn how to translate your first language file