PHPackages                             pijler/lang-scanner - 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. pijler/lang-scanner

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

pijler/lang-scanner
===================

An application for scanning files and updating translations.

v1.0.0(1mo ago)4525↓33.3%MITPHPPHP ^8.3CI passing

Since Sep 17Pushed 6mo agoCompare

[ Source](https://github.com/Pijler/lang-scanner)[ Packagist](https://packagist.org/packages/pijler/lang-scanner)[ RSS](/packages/pijler-lang-scanner/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (12)Versions (19)Used By (0)

📌 Lang Scanner
==============

[](#-lang-scanner)

A **universal translation key scanner** designed for **Laravel projects**.

It scans your codebase for translation calls, generates/updates your JSON language files, and ensures consistency across all locales.

Although it’s a Laravel package, it’s flexible enough to scan translations from **any type of project** (PHP, Vue, React, etc.) by customizing the `extensions` and `methods`.

### ✨ Features

[](#-features)

- 🔍 Scans translation calls in any file type (`.php`, `.js`, `.ts`, `.vue`, `.jsx`, …).
- ⚙️ Flexible configuration for methods (`__`, `trans`, `trans_choice`, `t`, `i18n.t`, …).
- 📂 Supports multiple paths and modules.
- 🧩 Extensible via `extends` for modular configs.
- ✅ `check` or `--check` checks if all language files have the same keys.
- 📑 `sort` automatically orders JSON keys globally (**enabled by default**).
- 🔗 `--dot` saves translations in dot notation.
- 🚫 `--no-update` skips updating JSON files when running `check` (verification only).
- 🔀 `merge` or `--merge` combines duplicate or related translations into a single entry.
- 📝 `--duplicate` lists all duplicate translations for review.
- ❌ `--remove` removes duplicate translations, keeping only the main version, when running `duplicate`.

### 📦 Installation

[](#-installation)

```
    composer require pijler/lang-scanner --dev
```

### ⚙️ Configuration

[](#️-configuration)

Create a `scanner.json` file at the root of your Laravel project.

#### Example: Laravel project:

[](#example-laravel-project)

```
{
    "scanner": [
        {
            "lang_path": "lang/",
            "paths": ["resources/"],
            "extensions": [".php"],
            "methods": ["__(*)", "trans(*)", "trans_choice(*)"]
        }
    ]
}
```

#### Example: Vue project inside Laravel:

[](#example-vue-project-inside-laravel)

```
{
    "scanner": [
        {
            "lang_path": "resources/lang/",
            "paths": ["resources/js/"],
            "extensions": [".js", ".vue"],
            "methods": ["$t(*)", "i18n.t(*)"]
        }
    ]
}
```

#### Example: React project inside Laravel:

[](#example-react-project-inside-laravel)

```
{
    "scanner": [
        {
            "lang_path": "resources/lang/",
            "paths": ["resources/js/"],
            "extensions": [".jsx", ".tsx"],
            "methods": ["t(*)", "i18n.t(*)"]
        }
    ]
}
```

#### Example: Multi-module config:

[](#example-multi-module-config)

```
{
    "extends": [
        "/module1/scanner.json",
        "/module2/scanner.json"
    ]
}
```

#### Example with `check`:

[](#example-with-check)

```
{
    "scanner": [
        {
            "check": true,
            "lang_path": "lang/"
        }
    ]
}
```

#### Example with `merge`:

[](#example-with-merge)

```
{
    "scanner": [
        {
            "merge": true,
            "lang_path": "lang/"
        }
    ]
}
```

### 📋 Usage

[](#-usage)

Run the scan:

```
    ./vendor/bin/scanner
```

The command will:

- Parse files defined in `paths` with the configured `extensions`.
- Detect translation calls based on the provided `methods`.
- Create or update JSON files inside `lang_path`.

### ⚡ CLI Options

[](#-cli-options)

#### `--check`

[](#--check)

Checks if that all language JSON files inside lang\_path have the same keys.

Reports inconsistencies when a key exists in one locale but is missing in another.

```
    ./vendor/bin/scanner --check
```

#### `--sort`

[](#--sort)

Sorts all JSON keys alphabetically. Enabled globally by default, can be disabled if needed:

```
    ./vendor/bin/scanner --sort=false
```

#### `--dot`

[](#--dot)

Saves JSON translations in **dot notation**:

```
{
    "auth.failed": "These credentials do not match our records."
}
```

```
    ./vendor/bin/scanner --dot
```

#### `--empty`

[](#--empty)

When using check, you may want to ignore empty translations as finished translations.

A good option to use in CI/CD pipelines.

```
    ./vendor/bin/scanner --check --empty
```

#### `--no-update`

[](#--no-update)

When using check, prevents updating JSON files even if sort or dot are enabled.

Useful for CI/CD validation pipelines.

```
    ./vendor/bin/scanner --check --no-update
```

#### `--merge`

[](#--merge)

Ensures that all language JSON files inside lang\_path have the same keys.

```
    ./vendor/bin/scanner --merge
```

#### `--duplicate`

[](#--duplicate)

Checks for and lists all duplicate records, allowing you to identify inconsistencies without modifying anything yet.

```
    ./vendor/bin/scanner --duplicate
```

#### `--remove`

[](#--remove)

After identifying duplicate records, automatically removes the repeated entries, keeping only the main version.

```
    ./vendor/bin/scanner --duplicate --remove
```

### 🧩 Extensibility with extends

[](#-extensibility-with-extends)

Use `extends` to reuse configs across modules:

```
{
    "extends": [
        "/packages/core/scanner.json",
        "/packages/admin/scanner.json"
    ]
}
```

### 💡 Best practices

[](#-best-practices)

- Configure `methods` according to your framework (`__(*)`/`trans(*)` for Laravel, `t(*)` for Vue/React).
- Always run with `check` in multi-language projects.
- Keep `sort` enabled for clean, ordered JSON files.
- Use `--no-update` in pipelines when you want validation only.
- Avoid duplicate keys, as you may forget and translate them differently.
- Centralize shared configs with `extends`.

Any improvement or correction can open a PR or Issue.

### 📝 License

[](#-license)

Open-source under the [MIT license](LICENSE).

🚀 Thanks!
---------

[](#-thanks)

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance76

Regular maintenance activity

Popularity21

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity59

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

Recently: every ~42 days

Total

17

Last Release

47d ago

Major Versions

v0.10.0 → v1.0.02026-03-24

PHP version history (2 changes)v0.0.1PHP ^8.2

v1.0.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/5256615ef2ba165b92bdf89908082480fb12be597c607637262e9fe61b5b2b22?d=identicon)[joaopalopes24@gmail.com](/maintainers/joaopalopes24@gmail.com)

---

Top Contributors

[![joaopalopes24](https://avatars.githubusercontent.com/u/45684782?v=4)](https://github.com/joaopalopes24 "joaopalopes24 (119 commits)")

---

Tags

phptranslationsscanner

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/pijler-lang-scanner/health.svg)

```
[![Health](https://phpackages.com/badges/pijler-lang-scanner/health.svg)](https://phpackages.com/packages/pijler-lang-scanner)
```

###  Alternatives

[gettext/languages

gettext languages with plural rules

7530.3M10](/packages/gettext-languages)[punic/punic

PHP-Unicode CLDR

1542.9M29](/packages/punic-punic)[gettext/php-scanner

PHP scanner for gettext

15471.2k12](/packages/gettext-php-scanner)[pharaonic/laravel-locations

Laravel - Countries\[States/Cities, Currency, Phone Code, Languages, Capital\] &amp; Continents &amp; Timezones.

102.4k1](/packages/pharaonic-laravel-locations)

PHPackages © 2026

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