PHPackages                             mortendhansen/laravel-database-translations - 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. [Database &amp; ORM](/categories/database)
4. /
5. mortendhansen/laravel-database-translations

ActiveLibrary[Database &amp; ORM](/categories/database)

mortendhansen/laravel-database-translations
===========================================

Managing laravel translations in database

v0.5.1(4y ago)2808MITPHPPHP ^8.0

Since Feb 25Pushed 4y ago1 watchersCompare

[ Source](https://github.com/MortenDHansen/laravel-database-translations)[ Packagist](https://packagist.org/packages/mortendhansen/laravel-database-translations)[ RSS](/packages/mortendhansen-laravel-database-translations/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (10)Dependencies (3)Versions (14)Used By (0)

laravel-database-translations
=============================

[](#laravel-database-translations)

[![run-tests](https://github.com/MortenDHansen/laravel-database-translations/actions/workflows/run-tests.yml/badge.svg?branch=main)](https://github.com/MortenDHansen/laravel-database-translations/actions/workflows/run-tests.yml)

**Laravel translations managed in database**

enables Laravels translations to be overridden, added or edited in database.

Laravel ships with [localization](https://laravel.com/docs/9.x/localization) built around a file structure that can be used in two ways:

- a .json file per language in the /lang directory, or
- php files returning an array nested in folders where first level is the locale

As a developer, it can be cumbersome to keep multiple language files updated with the keys - and sometimes your stakeholders / customers or user may want to participate in translating the software.

This package will *front* laravels localization so that

- translation/localization can happen in database
- missing keys are created on the fly, so you don't have to worry about missing keys in certain locales
- if a value is not set in the database, or a key is missing, it falls back to laravels defaults

Eg, you may use a translation like this:

```
__('animal')
```

The key will be created in the table for the current locale. So, if you have visitors from 10 different countries, it will update the table whenever the key is encountered and found missing.

If you have an en.json that sets `{"animal":"bird"}`, the result of the above will be 'bird'. You may now override that in the database by simply updating the record with:

```
$record = DatabaseLangItem::where('locale', 'en')->where('group', '*')->where('key', 'animal')->first();
$record->value = 'giraffe';
$record->save();
```

now result of `__('animal')` is giraffe.

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

[](#installation)

```
composer require mortendhansen/laravel-database-translations
```

Publish the migration:

```
artisan vendor:publish --provider="MortenDHansen\LaravelDatabaseTranslations\DatabaseTranslationsServiceProvider" --tag="migrations"
artisan migrate
```

Now you need to replace the laravel TranslationServiceProvider with the service provider from the package

```
\MortenDHansen\LaravelDatabaseTranslations\DatabaseTranslationsServiceProvider::class,
// Illuminate\Translation\TranslationServiceProvider::class,
```

Caching
-------

[](#caching)

Of course getting, and writing language keys whenever they appear is quite a heavy load of you have many of them. Therefore the package caches the keys. When cache is cold, the pages may be quite slow. You can use the artisan command `dbtrans:cache-rebuild` to drop keys and rebuild from table.

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~5 days

Recently: every ~12 days

Total

12

Last Release

1537d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a7e50c1e54059bf6d817d87735b658b8f02ccaccc63961caeb99f3e059b3ec95?d=identicon)[MortenDHansen](/maintainers/MortenDHansen)

---

Top Contributors

[![MortenDHansen](https://avatars.githubusercontent.com/u/5455310?v=4)](https://github.com/MortenDHansen "MortenDHansen (66 commits)")

---

Tags

laravellocalizationinternationalizationi18ntranslationslanguagetranslatedatabaseloadertranslatorlocalelaravel-translation-loader

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mortendhansen-laravel-database-translations/health.svg)

```
[![Health](https://phpackages.com/badges/mortendhansen-laravel-database-translations/health.svg)](https://phpackages.com/packages/mortendhansen-laravel-database-translations)
```

###  Alternatives

[illuminate/database

The Illuminate Database package.

2.8k54.9M11.7k](/packages/illuminate-database)[spatie/laravel-translation-loader

Store your language lines in the database, yaml or other sources

8453.2M68](/packages/spatie-laravel-translation-loader)[tomatophp/filament-translations

Manage your translation with DB and cache, you can scan your languages tags like trans(), \_\_(), and get the string inside and translate them use UI.

6335.5k3](/packages/tomatophp-filament-translations)[laravel-lang/common

Easily connect the necessary language packs to the application

1593.8M34](/packages/laravel-lang-common)[erag/laravel-lang-sync-inertia

A powerful Laravel package for syncing and managing language translations across backend and Inertia.js (Vue/React/Svelte) frontends, offering effortless localization, auto-sync features, and smooth multi-language support for modern Laravel applications.

4925.3k](/packages/erag-laravel-lang-sync-inertia)[omaralalwi/lexi-translate

Laravel translation package with morph relationships and caching.

7413.7k5](/packages/omaralalwi-lexi-translate)

PHPackages © 2026

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