PHPackages                             bambamboole/laravel-translation-dumper - 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. bambamboole/laravel-translation-dumper

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

bambamboole/laravel-translation-dumper
======================================

A laravel package to dump missing translation keys into the translation files

2.2.0(3w ago)1036.0k↓78.3%[2 PRs](https://github.com/bambamboole/laravel-translation-dumper/pulls)2MITPHPPHP ^8.2CI passing

Since Apr 16Pushed 2w ago1 watchersCompare

[ Source](https://github.com/bambamboole/laravel-translation-dumper)[ Packagist](https://packagist.org/packages/bambamboole/laravel-translation-dumper)[ Docs](https://github.com/bambamboole/laravel-translation-dumper)[ RSS](/packages/bambamboole-laravel-translation-dumper/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (10)Dependencies (13)Versions (30)Used By (2)

Laravel Translation Dumper
==========================

[](#laravel-translation-dumper)

[![Latest Version on Packagist](https://camo.githubusercontent.com/1e02de852c0c122d5f8bc651a49f8f90100bd94fc19c31b97a7dc459e48736bb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f62616d62616d626f6f6c652f6c61726176656c2d7472616e736c6174696f6e2d64756d7065722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bambamboole/laravel-translation-dumper)[![Total Downloads](https://camo.githubusercontent.com/71db9d767c04e0d324476c40aff558364f9727328b7820b5a51a90df8df0cee5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f62616d62616d626f6f6c652f6c61726176656c2d7472616e736c6174696f6e2d64756d7065722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bambamboole/laravel-translation-dumper)[![GitHub Actions](https://github.com/bambamboole/laravel-translation-dumper/actions/workflows/ci.yml/badge.svg)](https://github.com/bambamboole/laravel-translation-dumper/actions/workflows/ci.yml/badge.svg)[![codecov](https://camo.githubusercontent.com/89c016cc31d2868ada97712423bccc693ab14218c13d81a3be9690f784febc32/68747470733a2f2f636f6465636f762e696f2f67682f62616d62616d626f6f6c652f6c61726176656c2d7472616e736c6174696f6e2d64756d7065722f6272616e63682f6d61696e2f67726170682f62616467652e7376673f746f6b656e3d505454444d483544534a)](https://codecov.io/gh/bambamboole/laravel-translation-dumper)

This package provides an option to extend Laravels Translator to write missing translation keys to their respective translation files.
This is especially useful if you have dynamic translation keys where static dumpers do not work.

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 11, 12 or 13

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

[](#installation)

You can install the package via composer. Since this package should only be used in development, you should add the `--dev` flag.

```
composer require --dev bambamboole/laravel-translation-dumper
```

Usage
-----

[](#usage)

```
To enable the dumper, you have to set the environment variable `DUMP_TRANSLATIONS` to `true`.
```

Workflow
--------

[](#workflow)

Just write your templates and use the `__()` helper as usual with your preferred translation key pattern. As soon as you visit the page, the missing translation keys, they will be written to the respective translation files in the structure that the first part of the key is the file name and the rest is the nested path of a PHP array. As value it takes the translation key itself prefixed by a configurable prefix.

By default a dotted key goes into a flat top level file (`a.b.c` → `a.php`), unless a matching nested file already exists (`a/b.php`), in which case the key is written there.

Writing translations
--------------------

[](#writing-translations)

Persistence is handled behind the `TranslationWriter` interface, and the package ships a `FileTranslationWriter` that reads, merges and writes the lang files (PHP via `brick/varexporter`, JSON with unescaped unicode/slashes, both with an exclusive lock). Bind your own implementation to `TranslationWriter::class` to persist elsewhere.

```
use Bambamboole\LaravelTranslationDumper\FileTranslationWriter;
use Bambamboole\LaravelTranslationDumper\TranslationDumper;

$dumper = new TranslationDumper(new FileTranslationWriter($filesystem, lang_path()), 'en');
```

### Dumping into a specific (nested) file

[](#dumping-into-a-specific-nested-file)

Pass a `group` to write every translation into one file, **creating it if needed** — the group is the path under the locale directory, so it can be nested:

```
$dumper->dump([
    new Translation('subtitle', 'x-subtitle'),
    new Translation('status.open', 'x-status.open'),
], 'entities/salesOrder');
// -> lang/en/entities/salesOrder.php  (created), keys relative to the group
```

This pairs with i18next namespaces (`entities/salesOrder`), where the namespace is the group path: missing keys round-trip straight back into the matching nested file.

### Dumping Laravel package namespaces

[](#dumping-laravel-package-namespaces)

Laravel package translation keys use the `package::file.line` syntax after the package has registered its lang directory with `loadTranslationsFrom($path, 'package')`. Namespaced package keys are ignored by default. Enable the namespaces you want to dump in `config/translation.php`:

```
'dump_namespaces' => ['courier'],
```

With that enabled, a missing `__('courier::messages.welcome')` call writes to the registered package lang path, for example `packages/courier/lang/en/messages.php`. Keys without a namespace continue to be dumped without a `package::` prefix.

Package namespace dumping is for PHP translation files (`package::file.line`). JSON translation paths registered with `loadJsonTranslationsFrom()` continue to use Laravel's JSON translation flow.

### Testing

[](#testing)

```
composer test
```

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

[](#contributing)

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

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Manuel Christlieb](https://github.com/bambamboole)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance96

Actively maintained with recent releases

Popularity35

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity68

Established project with proven stability

 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 ~77 days

Recently: every ~106 days

Total

16

Last Release

21d ago

Major Versions

0.5.0 → 1.0.02024-08-08

1.3.0 → 2.0.02026-06-11

PHP version history (2 changes)0.1.0PHP ^8.1

2.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/547137a6d80cad01ed1dd065b1c6af329d9a23a4134a895cff01e078cc155500?d=identicon)[bambamboole](/maintainers/bambamboole)

---

Top Contributors

[![bambamboole](https://avatars.githubusercontent.com/u/8823695?v=4)](https://github.com/bambamboole "bambamboole (60 commits)")

---

Tags

laraveltranslationsbambambooletranslation-dumper

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/bambamboole-laravel-translation-dumper/health.svg)

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

###  Alternatives

[barryvdh/laravel-translation-manager

Manage Laravel Translations

1.7k3.8M18](/packages/barryvdh-laravel-translation-manager)[illuminate/validation

The Illuminate Validation package.

18838.2M1.7k](/packages/illuminate-validation)[kkomelin/laravel-translatable-string-exporter

Translatable String Exporter for Laravel

3301.5M20](/packages/kkomelin-laravel-translatable-string-exporter)[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)[kerigard/laravel-lang-ru

Ru lang for Laravel

2122.8k](/packages/kerigard-laravel-lang-ru)

PHPackages © 2026

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