PHPackages                             fzayne/lara-translation - 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. fzayne/lara-translation

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

fzayne/lara-translation
=======================

A Laravel package to extract translation keys from source files and export them into a dedicated translation file.

v1.0.0(1y ago)110MITPHP

Since Apr 14Pushed 1y ago1 watchersCompare

[ Source](https://github.com/fzayne/lara-translation)[ Packagist](https://packagist.org/packages/fzayne/lara-translation)[ RSS](/packages/fzayne-lara-translation/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

LaraTranslation
===============

[](#laratranslation)

**LaraTranslation** is a Laravel package that extracts translation keys from your PHP and Blade files and exports them to JSON files for multiple locales.

This is especially useful for applications using Laravel's JSON translation format, helping you keep track of all translation keys in use throughout your views and code.

---

🚀 Features
----------

[](#-features)

- Scan specific directories for translation function calls
- Supports `trans()`, `__()`, and `@lang` patterns
- Exports translation keys to JSON files per locale
- Merges with existing translations without overwriting existing values
- Easy Artisan command to trigger extraction and export

---

📦 Installation
--------------

[](#-installation)

### Step 1: Install via Composer

[](#step-1-install-via-composer)

If using directly from GitHub:

```
composer require fzayne/lara-translation
```

### Step 2: Publish Config

[](#step-2-publish-config)

```
php artisan vendor:publish --tag=lara-translation-config
```

---

⚙️ Configuration
----------------

[](#️-configuration)

The package provides a simple way to customize the directories, patterns, and output file where translation keys are extracted and stored.

### 1. **Directories**

[](#1-directories)

You can define the directories in which the package will search for translation keys. By default, the package looks for translation keys in the `app/View` and `resource/views` directories. You can add or modify these directories in the configuration file to include other locations as needed.

```
    'directories' => [
        app_path('View'),
        resource_path('views'),
    ],
```

### 2. **Patterns**

[](#2-patterns)

The package supports searching for specific translation functions or patterns within your files. The default patterns include common Laravel translation functions like `trans()`, `__()`, and `@lang`. You can customize this list to match any other translation function or pattern that you use in your application.

```
      'patterns' => [
        'trans',
        '__',
        '@lang',
    ],
```

### 3. **Output Path**

[](#3-output-path)

Once the translation keys are extracted, they are saved to a file. By default, these keys are stored in the language files within the `lang/` directory. You can configure a different output path where the generated files will be saved. This makes it easy to organize your translation keys wherever you need them.

---

This configuration allows you to easily control where the package searches for translation keys, what functions or patterns it looks for, and where the output files will be saved.

---

🛠 Usage
-------

[](#-usage)

Run the Artisan command to export translation keys:

```
php artisan transkeys:export {locales?*}
```

**Exemple:**

```
php artisan transkeys:export en fr ar
```

This will create or update `en.json`, `fr.json`, and `ar.json` in your `lang/` folder with all translation keys found.

---

License
=======

[](#license)

This package is open-source and available under the [MIT License](LICENSE).

You are free to use, modify, and distribute it, as long as you include the original copyright and license notice in your copies of the software.

---

Credits
=======

[](#credits)

This package was inspired by the work of [KaziSTM](https://github.com/KaziSTM), who provided valuable insights and ideas for extracting translation keys more efficiently. Special thanks to the open-source community for their contributions.

If you use or find this package useful, feel free to credit the original ideas and contributions.

---

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance47

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

391d ago

### Community

Maintainers

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

---

Top Contributors

[![fzayne](https://avatars.githubusercontent.com/u/100533021?v=4)](https://github.com/fzayne "fzayne (2 commits)")

### Embed Badge

![Health badge](/badges/fzayne-lara-translation/health.svg)

```
[![Health](https://phpackages.com/badges/fzayne-lara-translation/health.svg)](https://phpackages.com/packages/fzayne-lara-translation)
```

###  Alternatives

[symfony/translation

Provides tools to internationalize your application

6.6k836.5M2.0k](/packages/symfony-translation)[nesbot/carbon

An API extension for DateTime that supports 281 different languages.

169661.4M4.8k](/packages/nesbot-carbon)[joedixon/laravel-translation

A tool for managing all of your Laravel translations

717911.4k11](/packages/joedixon-laravel-translation)[illuminate/translation

The Illuminate Translation package.

6936.4M491](/packages/illuminate-translation)[lajax/yii2-translate-manager

Translation management extension for Yii 2

227578.8k13](/packages/lajax-yii2-translate-manager)[larswiegers/laravel-translations-checker

Make sure your laravel translations are checked and are included in all languages.

256423.2k2](/packages/larswiegers-laravel-translations-checker)

PHPackages © 2026

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