PHPackages                             eg-mohamed/laravelmissingtranslations - 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. eg-mohamed/laravelmissingtranslations

ActiveLibrary

eg-mohamed/laravelmissingtranslations
=====================================

Scan Laravel project files and append missing translation keys to JSON locale files

1.2.0(1mo ago)04↑650%MITPHPPHP ^8.4CI failing

Since Mar 18Pushed 1mo agoCompare

[ Source](https://github.com/EG-Mohamed/laravel-missing-translations)[ Packagist](https://packagist.org/packages/eg-mohamed/laravelmissingtranslations)[ Docs](https://github.com/eg-mohamed/laravelmissingtranslations)[ GitHub Sponsors]()[ RSS](/packages/eg-mohamed-laravelmissingtranslations/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (8)Versions (5)Used By (0)

[![bannar.svg](assets/bannar.svg)](assets/bannar.svg)[![Latest Version on Packagist](https://camo.githubusercontent.com/9e0632e22d54edf0311bd5b131e6dbd88962b9b547316bbbe30ec7641deef504/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f65672d6d6f68616d65642f6c61726176656c6d697373696e677472616e736c6174696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/eg-mohamed/laravelmissingtranslations)[![Total Downloads](https://camo.githubusercontent.com/c5ada3409bceb7657b99a638e6ec43d7545f5d9f1f314701382935d07aa769ba/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f65672d6d6f68616d65642f6c61726176656c6d697373696e677472616e736c6174696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/eg-mohamed/laravelmissingtranslations)

A Laravel dev-tool that scans your project for translation function calls and appends any missing keys to your JSON locale files. No more manually hunting for untranslated strings.

Supports `__()`, `trans()`, `trans_choice()`, `@lang()`, `@choice()`, and `Lang::get/has/choice()`.

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

[](#installation)

Install as a dev dependency:

```
composer require eg-mohamed/laravelmissingtranslations --dev
```

Publish the config file:

```
php artisan vendor:publish --tag="laravelmissingtranslations-config"
```

Configuration
-------------

[](#configuration)

```
// config/laravelmissingtranslations.php

return [
    // Directories to scan
    'paths' => [app_path(), resource_path('views')],

    // File extensions to include
    'extensions' => ['php', 'blade.php'],

    // Directories to exclude from scanning
    'exclude_paths' => [],

    // Sort keys alphabetically in the JSON output
    'sort_keys' => true,

    // Skip dotted keys like 'auth.failed' (PHP array-based translations)
    'exclude_dot_keys' => false,

    // Translation functions to detect
    'include_functions' => ['__', 'trans', 'trans_choice', '@lang', '@choice', 'Lang::get', 'Lang::has', 'Lang::choice'],

    // Regex patterns for keys to skip
    'exclude_patterns' => [],

    // Flags passed to json_encode when writing locale files
    'json_flags' => JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE,
];
```

Usage
-----

[](#usage)

### Scan and write missing keys

[](#scan-and-write-missing-keys)

```
php artisan missing-translations en
```

This scans your project, compares found keys against `lang/en.json`, and appends any missing ones with an empty string value.

If no locale argument is provided and `--all` is not used, the command falls back to `config('app.locale')` automatically:

```
php artisan missing-translations
```

### Preview without writing

[](#preview-without-writing)

```
php artisan missing-translations en --dry-run
```

Displays a table of missing keys without modifying any files. Also shows summary statistics:

```
Keys scanned: 42 | Existing: 38 | Missing: 4
Dry run mode: no changes written.

```

### Process all existing locale files at once

[](#process-all-existing-locale-files-at-once)

```
php artisan missing-translations --all
```

Runs the scan against every `lang/*.json` file found in your project. If no JSON files exist, a helpful message is shown instead of a generic error.

### Remove unused keys

[](#remove-unused-keys)

```
php artisan missing-translations en --remove-unused
```

Finds keys that exist in `lang/en.json` but are no longer referenced in any scanned file, displays them, and removes them. Combine with `--dry-run` to preview without making changes:

```
php artisan missing-translations en --remove-unused --dry-run
```

### JSON output for CI pipelines

[](#json-output-for-ci-pipelines)

```
php artisan missing-translations en --json
```

Outputs results as JSON to stdout instead of the table format. Useful for CI pipelines — e.g. fail a build if missing translations count &gt; 0:

```
{
    "locale": "en",
    "existing_count": 38,
    "missing_count": 4,
    "missing_keys": [
        "New Key One",
        "New Key Two"
    ]
}
```

With `--remove-unused`:

```
{
    "locale": "en",
    "existing_count": 38,
    "missing_count": 4,
    "missing_keys": ["New Key One"],
    "unused_count": 2,
    "unused_keys": ["Old Key", "Stale Key"]
}
```

How it works
------------

[](#how-it-works)

1. Uses Symfony Finder to crawl configured `paths` for files matching configured `extensions`
2. Extracts translation keys via regex from all supported function calls
3. Diffs found keys against the existing locale JSON file
4. Appends missing keys with an empty string value, leaving existing translations untouched
5. Re-running the command is safe — no duplicates are ever added
6. File writes use `LOCK_EX` to prevent corruption from concurrent runs

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)

- [Mohamed Said](https://github.com/EG-Mohamed)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance89

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity54

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

Total

4

Last Release

55d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/23424932?v=4)[Mohamed Said](/maintainers/EG-Mohamed)[@EG-Mohamed](https://github.com/EG-Mohamed)

---

Top Contributors

[![EG-Mohamed](https://avatars.githubusercontent.com/u/23424932?v=4)](https://github.com/EG-Mohamed "EG-Mohamed (9 commits)")

---

Tags

laravelMohamed Saidlaravelmissingtranslations

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/eg-mohamed-laravelmissingtranslations/health.svg)

```
[![Health](https://phpackages.com/badges/eg-mohamed-laravelmissingtranslations/health.svg)](https://phpackages.com/packages/eg-mohamed-laravelmissingtranslations)
```

###  Alternatives

[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[spatie/laravel-prometheus

Export Laravel metrics to Prometheus

2651.3M6](/packages/spatie-laravel-prometheus)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)[scalar/laravel

Render your OpenAPI-based API reference

6183.9k2](/packages/scalar-laravel)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[musahmusah/laravel-multipayment-gateways

A Laravel Package that makes implementation of multiple payment Gateways endpoints and webhooks seamless

852.2k1](/packages/musahmusah-laravel-multipayment-gateways)

PHPackages © 2026

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