Getting Started
This guide will walk you through setting up LangSyncer with your Laravel application.
Prerequisites
- Laravel 10+ application
- PHP 8.2 or higher
- Composer installed
- A LangSyncer account
Step 1: Create an Account
- Go to LangSyncer and click Start for Free
- Register with your email
- You'll start on the Free tier
Step 2: Create Your First Project
- Navigate to Projects in the sidebar
- Click New Project
- Complete the project details and save
- Open the project's actions modal and go to API Key & CDN tab
- Copy your API Key - you'll need this next
Step 3: Install the Laravel Package
composer require headwires/translator-client
Publish the configuration file:
php artisan vendor:publish --tag=translator-client-config
Step 4: Configure Your Environment
Add your configuration to .env:
# Required
CLI_TRANSLATOR_API_KEY=your-api-key-here
CLI_TRANSLATOR_CDN_URL=https://cdn.langsyncer.com
# Optional
CLI_TRANSLATOR_PROJECT_NAME="My Project"
CLI_TRANSLATOR_CLIENT_MODE=live
CLI_TRANSLATOR_SYNC_STRATEGY=overwrite
CLI_TRANSLATOR_CLIENT_CACHE_PREFIX=translator
CLI_TRANSLATOR_CLIENT_CACHE_TTL=3600
CLI_TRANSLATOR_CLIENT_WEBHOOK_ENABLED=true
Important: Copy the
CLI_TRANSLATOR_CDN_URLfrom your project's API Key & CDN tab. This is the base URL where your translations are hosted.
Environment Variables Reference
| Variable | Required | Default | Description |
|---|---|---|---|
CLI_TRANSLATOR_API_KEY |
Yes | - | Your project API key from LangSyncer |
CLI_TRANSLATOR_CDN_URL |
Yes | - | CDN base URL (copy from project's Actions modal) |
CLI_TRANSLATOR_CLIENT_MODE |
Yes | static |
static, live, or auto |
CLI_TRANSLATOR_CLIENT_WEBHOOK_ENABLED |
Recommended | true |
Enable webhook for instant updates |
CLI_TRANSLATOR_PROJECT_NAME |
No | main |
Display name for the project |
CLI_TRANSLATOR_SYNC_STRATEGY |
No | overwrite |
overwrite or merge |
CLI_TRANSLATOR_CLIENT_CACHE_DRIVER |
No | Laravel default | Cache driver for translations |
CLI_TRANSLATOR_CLIENT_CACHE_PREFIX |
No | translator |
Cache key prefix |
CLI_TRANSLATOR_CLIENT_CACHE_TTL |
No | 3600 |
Cache TTL in seconds |
CLI_TRANSLATOR_CLIENT_WEBHOOK_ROUTE |
No | /api/translator/webhook |
Custom webhook endpoint |
CLI_TRANSLATOR_METADATA_PATH |
No | storage/translator-client |
Metadata path (static mode only) |
Client Modes
| Mode | Description |
|---|---|
static |
File-based storage. Requires running translator:sync or webhook to update. |
live |
Cache-based with instant updates via webhooks. Changes propagate in seconds. |
auto |
Automatically detects best mode (live for Vapor/serverless, static otherwise). |
Sync Strategies
| Strategy | Description |
|---|---|
overwrite |
Replaces local files completely with CDN version. |
merge |
Merges CDN translations with local, preserving local-only keys. CDN values take precedence. |
Step 5: Warm Up Translations
Pre-cache your translations for optimal performance:
php artisan translator:warmup
This downloads all translations from the CDN and caches them locally.
Step 6: Test It Out
- Go to the LangSyncer dashboard
- Navigate to your project's Translations
- Create or edit a translation
- Click Publish
- Refresh your Laravel app - the change appears instantly!
Available Commands
| Command | Description |
|---|---|
translator:warmup |
Pre-cache all translations |
translator:sync |
Download translations from CDN |
translator:status |
View sync status and statistics |
translator:scan |
Scan code for hardcoded text |
translator:apply |
Apply Code Scanner changes |
Using Translations
After setup, use Laravel's translation helpers as normal:
// In Blade templates
{{ __('messages.welcome') }}
{{ __('messages.greeting', ['name' => $user->name]) }}
// In PHP
$message = __('validation.required', ['attribute' => 'email']);
What's Next?
- Projects - Manage multiple projects
- Translations - Create and edit translations
- AI Translations - Translate automatically with AI
- Code Scanner - Find hardcoded text in your code
Need Help?
- Check the FAQ for common questions
- Visit Troubleshooting for solutions