Download the PHP package mgcodeur/laravel-translation-loader without Composer
On this page you can find all versions of the php package mgcodeur/laravel-translation-loader. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mgcodeur/laravel-translation-loader
More information about mgcodeur/laravel-translation-loader
Files in mgcodeur/laravel-translation-loader
Package laravel-translation-loader
Short Description Store your translations in the database
License MIT
Homepage https://github.com/mgcodeur/laravel-translation-loader
Informations about the package laravel-translation-loader
β‘ Laravel Translation Loader
Manage Laravel translations in a database with version-controlled migration files. This package streamlines multilingual app development, letting you create, update, and maintain translations without touching JSON or PHP files.
π Quick Start
Get up and running in three steps.
1. Install the Package
Install the package to your Laravel project:
2. Publish Assets
Publish configuration and migration files:
This generates:
config/translation-loader.php
(package settings)database/migrations/create_translations_table.php
database/migrations/create_languages_table.php
database/migrations/create_translation_migrations_table.php
(table for translations migrations)
3. Run Migrations
Run the migrations:
π οΈ Creating Translation Migrations
Generate a migration to define translations:
π This creates a file in database/translations/
:
Apply or Revert Migrations
Run all pending translation migrations:
Rollback the last migration:
π― Usage
Access translations as you would with standard Laravel language files:
π¦ Bonus Features
1. Check Migration Status
View the status of translation migrations:
Example Output:
2. Generate Language Files
π Export database translations to Laravelβs lang
directory:
This creates files like:
π‘ Customize the output path in config/translation-loader.php
.
βοΈ Configuration
Customize settings in config/translation-loader.php
β¨ Extra Helpers
- addMany
Add multiple keys at once.
or
- update
Update existing translations.
Fallbacks
If a translation is missing, Laravel will fall back to the default language defined in your config/app.php
.
β FAQ
Q: Can I use this with existing JSON/PHP translation files?
A: Yes! The package works alongside file-based translations.
Q: How does caching work?
A: Translations are cached. Automatically cleared when migrations are applied or rolled back.
π License
Licensed under the MIT License.
β€οΈ Support the Project
If this package saves you time:
- β Star the GitHub repo
- π’ Share it with your network
- πΈ Sponsor development via GitHub Sponsors
For more help, check GitHub Issues or open a new issue.
All versions of laravel-translation-loader with dependencies
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^10.0||^11.0||^12.0