PHPackages                             sawirricardo/laravel-translation-loader - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Localization &amp; i18n](/categories/localization)
4. /
5. sawirricardo/laravel-translation-loader

ActiveLibrary[Localization &amp; i18n](/categories/localization)

sawirricardo/laravel-translation-loader
=======================================

Store your translations in the database or other sources, using the modern packages

0.0.3(3y ago)0245[2 PRs](https://github.com/sawirricardo/laravel-translation-loader/pulls)MITPHPPHP ^8.1

Since Jul 1Pushed 2y ago1 watchersCompare

[ Source](https://github.com/sawirricardo/laravel-translation-loader)[ Packagist](https://packagist.org/packages/sawirricardo/laravel-translation-loader)[ Docs](https://github.com/sawirricardo/laravel-translation-loader)[ RSS](/packages/sawirricardo-laravel-translation-loader/feed)WikiDiscussions main Synced yesterday

READMEChangelog (3)Dependencies (13)Versions (6)Used By (0)

Store your translations in the database or other sources, using the modern packages
===================================================================================

[](#store-your-translations-in-the-database-or-other-sources-using-the-modern-packages)

[![Latest Version on Packagist](https://camo.githubusercontent.com/7c52a670a006670e810d8a070639a9b323a2fb4083417fc9c9f25ba3d84f4068/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73617769727269636172646f2f6c61726176656c2d7472616e736c6174696f6e2d6c6f616465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sawirricardo/laravel-translation-loader)[![GitHub Tests Action Status](https://camo.githubusercontent.com/8e77862913ffde5646157359cdaab068e303d3c10e7ec18ad3114f4d8cdda6fe/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f73617769727269636172646f2f6c61726176656c2d7472616e736c6174696f6e2d6c6f616465722f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/sawirricardo/laravel-translation-loader/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/f6d35f6aeb13fceb57a00f2f035cdf4598f7a89be70c60ae5a67e45de1dae7b9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f73617769727269636172646f2f6c61726176656c2d7472616e736c6174696f6e2d6c6f616465722f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/sawirricardo/laravel-translation-loader/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/a0f283f6096559e638bf68eadec117cc18934936c93b7d5faa61a151acd61aa4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73617769727269636172646f2f6c61726176656c2d7472616e736c6174696f6e2d6c6f616465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sawirricardo/laravel-translation-loader)

In a vanilla Laravel or Lumen installation you can use language files to localize your app. This package will enable the translations to be stored in the database. You can still use all the features of the trans function you know and love.

```
trans('messages.welcome', ['name' => 'dayle']);
```

You can even mix using language files and the database. If a translation is present in both a file and the database, the database version will be returned.

Support us
----------

[](#support-us)

[![](https://camo.githubusercontent.com/d4a710fef761fd7be0e0460a243b2c217e7e182457c50025937ad0b9186fc974/68747470733a2f2f6769746875622d6164732e73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f6c61726176656c2d7472616e736c6174696f6e2d6c6f616465722e6a70673f743d31)](https://spatie.be/github-ad-click/laravel-translation-loader)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require sawirricardo/laravel-translation-loader
```

You can publish and run the migrations with:

```
php artisan vendor:publish --tag="laravel-translation-loader-migrations"
php artisan migrate
```

You can publish the config file with:

```
php artisan vendor:publish --tag="laravel-translation-loader-config"
```

This is the contents of the published config file:

```
'translation_loaders' => [
    \Sawirricardo\LaravelTranslationLoader\TranslationLoaders\Db::class,
],

'model' => \Sawirricardo\LaravelTranslationLoader\Models\Translation::class,

'translation_manager' => \Sawirricardo\LaravelTranslationLoader\TranslationLoaderManager::class,

'locals' => [
    'en' => 'English',
    'ar' => 'Arabic',
    'pt_BR' => 'Português (Brasil)',
    'my' => 'Burmese',
    'id' => 'Bahasa Indonesia',
],

'paths' => [
    app_path(),
    resource_path('views'),
    base_path('vendor'),
],

'excluded_paths' => [
    //
],
```

Usage
-----

[](#usage)

```
use Sawirricardo\LaravelTranslationLoader\Models\Translation;

Translation::create([
   'group' => 'validation',
   'key' => 'required',
   'text' => ['en' => 'This is a required field', 'nl' => 'Dit is een verplicht veld'],
]);
```

You can fetch the translation with [Laravel's default trans function](https://laravel.com/docs/5.3/localization#retrieving-language-lines):

```
trans('validation.required'); // returns 'This is a required field'

app()->setLocale('nl');

trans('validation.required'); // returns 'Dit is een verplicht veld'
```

Creating your own translation providers
---------------------------------------

[](#creating-your-own-translation-providers)

This package ships with a translation provider than can fetch translations from the database. If you're storing your translations in a yaml-file, a csv-file, or ... you can easily extend this package by creating your own translation provider.

A translation provider can be any class that implements the `Sawirricardo\LaravelTranslationLoader\TranslationLoaders\TranslationLoader`-interface. It contains only one method:

namespace Sawirricardo\\LaravelTranslationLoader\\TranslationLoaders;

interface TranslationLoader { public function loadTranslations($locale, $group); } Translation providers can be registered in the translation\_loaders key of the config file.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Ricardo Sawir](https://github.com/sawirricardo)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

3

Last Release

1097d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/23599e5bcea6210e7c2aa6ab912ab4dc501ca63911cc8a99c46a7b4f57a658ad?d=identicon)[ricardosawir](/maintainers/ricardosawir)

---

Top Contributors

[![sawirricardo](https://avatars.githubusercontent.com/u/37329575?v=4)](https://github.com/sawirricardo "sawirricardo (20 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (2 commits)")

---

Tags

laravellaravel-translation-loadersawirricardo

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/sawirricardo-laravel-translation-loader/health.svg)

```
[![Health](https://phpackages.com/badges/sawirricardo-laravel-translation-loader/health.svg)](https://phpackages.com/packages/sawirricardo-laravel-translation-loader)
```

###  Alternatives

[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.1k11.2M100](/packages/dedoc-scramble)[spatie/laravel-passkeys

Use passkeys in your Laravel app

471890.7k39](/packages/spatie-laravel-passkeys)[finity-labs/fin-mail

A powerful email template manager and composer for Filament with dynamic token replacement, template versioning, and inline email sending.

284.5k1](/packages/finity-labs-fin-mail)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[elegantly/laravel-translator

All on one translations management for Laravel

6333.1k](/packages/elegantly-laravel-translator)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
