PHPackages                             aar/laravel-auto-translator - 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. aar/laravel-auto-translator

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

aar/laravel-auto-translator
===========================

A comprehensive, high-performance translation management system for Laravel with AI translation, dashboard UI, and CLI tools.

v1.0.1(3mo ago)06MITPHPPHP ^8.1

Since Mar 5Pushed 3mo agoCompare

[ Source](https://github.com/ahmed-abdalrazek/laravel-auto-translator)[ Packagist](https://packagist.org/packages/aar/laravel-auto-translator)[ RSS](/packages/aar-laravel-auto-translator/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (11)Versions (6)Used By (0)

aar/laravel-auto-translator
===========================

[](#aarlaravel-auto-translator)

A **production-ready, high-performance translation management system** for Laravel.
Handles **10,000+ translation keys** with AI-powered translations, a modern dashboard, CLI tools, and full database storage.

> ✅ Ready for **GitHub** and **Packagist** — `composer require aar/laravel-auto-translator`

---

Features
--------

[](#features)

FeatureDescription🔍 **High-Speed Scanner**Scans PHP, Blade, Vue, React, JS/TS with incremental file-hash caching🤖 **AI Translation**LibreTranslate (default), DeepL, Google Translate, OpenAI🧠 **Translation Memory**Never re-translates the same phrase twice🗑️ **Dead Key Detection**Finds and removes orphaned translation keys🌐 **Multi-Locale**Manage any number of locales dynamically via CLI🗄️ **Database Storage**Fully indexed database tables with file sync🖥️ **Dashboard UI**Inline editing, search, filter, bulk actions, progress bars⚡ **CLI Commands**`scan`, `auto`, `clean`, `export`, `import`, `status`, `lang`📦 **Export/Import**JSON, CSV, ZIP formats---

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

[](#requirements)

- PHP 8.1+
- Laravel 10, 11, or 12
- Composer

---

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

[](#installation)

```
composer require aar/laravel-auto-translator
```

### Publish Configuration

[](#publish-configuration)

```
php artisan vendor:publish --tag=aar-translator-config
```

### Run Migrations

[](#run-migrations)

```
php artisan migrate
```

---

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

[](#configuration)

The config file is at `config/aar-translator.php` after publishing.

### Key Settings

[](#key-settings)

```
return [
    'locales'       => ['en', 'ar', 'fr', 'es'],
    'source_locale' => 'en',
    'storage'       => 'both',          // 'file', 'database', or 'both'
    'scan_paths'    => ['app', 'resources'],
    'excluded_dirs' => ['vendor', 'node_modules', 'storage'],
    'translator'    => env('AAR_TRANSLATOR_PROVIDER', 'libretranslate'),
    'memory'        => ['enabled' => true, 'driver' => 'database'],
    'dashboard'     => [
        'enabled'    => true,
        'path'       => 'admin/translations',
        'middleware' => ['web'],
    ],
];
```

---

AI Translation Setup
--------------------

[](#ai-translation-setup)

### LibreTranslate (Free, Open-Source – Default)

[](#libretranslate-free-open-source--default)

```
AAR_TRANSLATOR_PROVIDER=libretranslate
LIBRETRANSLATE_URL=https://libretranslate.com
LIBRETRANSLATE_API_KEY=your-optional-api-key
```

Self-host for free: `pip install libretranslate && libretranslate --host 0.0.0.0 --port 5000`

### DeepL

[](#deepl)

```
AAR_TRANSLATOR_PROVIDER=deepl
DEEPL_API_KEY=your-deepl-api-key
DEEPL_FREE_API=true
```

### Google Translate

[](#google-translate)

```
AAR_TRANSLATOR_PROVIDER=google
GOOGLE_TRANSLATE_API_KEY=your-google-api-key
```

### OpenAI (GPT-4o-mini or better)

[](#openai-gpt-4o-mini-or-better)

```
AAR_TRANSLATOR_PROVIDER=openai
OPENAI_API_KEY=your-openai-key
OPENAI_MODEL=gpt-4o-mini
```

---

CLI Commands
------------

[](#cli-commands)

All commands use the `aar:` prefix.

### Scan Project

[](#scan-project)

```
# Incremental scan (skips unchanged files)
php artisan aar:scan

# Full scan (clears file hash cache)
php artisan aar:scan --fresh

# Scan and immediately export to language files
php artisan aar:scan --export
```

### Auto-Translate Missing Keys

[](#auto-translate-missing-keys)

```
# Translate all missing keys for all locales
php artisan aar:auto

# Translate a specific locale only
php artisan aar:auto --locale=ar

# Override the provider for this run
php artisan aar:auto --provider=deepl

# Translate and export to files
php artisan aar:auto --export
```

### Clean Dead Keys

[](#clean-dead-keys)

```
# Preview dead keys without deleting (dry run)
php artisan aar:clean --dry-run

# Delete dead keys (with confirmation prompt)
php artisan aar:clean

# Delete without confirmation
php artisan aar:clean --force
```

### Export Translations

[](#export-translations)

```
php artisan aar:export               # JSON (default)
php artisan aar:export --format=csv  # CSV
php artisan aar:export --format=zip  # ZIP (one JSON per locale)
php artisan aar:export --locale=ar   # Export single locale
```

### Import Translations

[](#import-translations)

```
php artisan aar:import translations.json
php artisan aar:import translations.csv
```

### Translation Status

[](#translation-status)

```
php artisan aar:status
```

Example output:

```
📊 Translation Status

  Total Keys : 142
  Dead Keys  : 3

 Locale  Translated  Missing  Total  Progress
 EN      142         0        142    100.0% [████████████████████]
 AR      87          55       142    61.3%  [████████████░░░░░░░░]
 FR      130         12       142    91.5%  [██████████████████░░]

```

### Manage Locales

[](#manage-locales)

```
# Add a new locale
php artisan aar:lang add de

# Remove a locale
php artisan aar:lang remove es
```

---

Dashboard
---------

[](#dashboard)

Access the web dashboard at `/admin/translations` (configurable).

### Dashboard Features

[](#dashboard-features)

- **Overview**: Total keys, dead keys, missing translations, locale completion bars
- **Keys List**: Paginated table with search, group filter, missing-only filter
- **Inline Editing**: Click any translation to edit it directly in the browser
- **Bulk Actions**: Delete all dead keys, trigger scan, trigger auto-translate
- **Export**: Download JSON, CSV, or ZIP directly from the browser
- **Import**: Upload a JSON or CSV file to import translations

### Securing the Dashboard

[](#securing-the-dashboard)

Edit `config/aar-translator.php`:

```
'dashboard' => [
    'enabled'    => true,
    'path'       => 'admin/translations',
    'middleware' => ['web', 'auth'],        // Require authenticated users
    // Or with permissions:
    // 'middleware' => ['web', 'can:manage-translations'],
],
```

---

Publishing Assets
-----------------

[](#publishing-assets)

```
# Publish config
php artisan vendor:publish --tag=aar-translator-config

# Publish migrations
php artisan vendor:publish --tag=aar-translator-migrations

# Publish views (to customise the dashboard)
php artisan vendor:publish --tag=aar-translator-views
```

---

Database Tables
---------------

[](#database-tables)

The package creates three tables:

TablePurpose`translation_keys`Stores each unique translation key with group and dead-key flag`translation_values`Stores the translated value per key and locale`translation_memory`Caches previously translated phrases to avoid redundant API calls---

Translation Memory
------------------

[](#translation-memory)

Translation memory prevents duplicate API calls by caching phrase-to-phrase translations.

```
// config/aar-translator.php
'memory' => [
    'enabled' => true,
    'driver'  => 'database',   // 'database' or 'cache'
],
```

Use `'driver' => 'cache'` for Redis-backed memory in high-traffic apps.

---

Incremental Scanning
--------------------

[](#incremental-scanning)

File hashes are cached in `storage/app/aar-translator/file-cache.json`. Only modified files are re-scanned on subsequent runs, making it fast even for large codebases.

---

Package Structure
-----------------

[](#package-structure)

```
aar/laravel-auto-translator/
├── config/
│   └── aar-translator.php          # Main configuration
├── database/
│   └── migrations/
│       ├── ...create_translation_keys_table.php
│       ├── ...create_translation_values_table.php
│       └── ...create_translation_memory_table.php
├── resources/
│   └── views/
│       └── dashboard/
│           ├── layout.blade.php
│           ├── index.blade.php     # Dashboard overview
│           └── keys.blade.php      # Keys management
├── routes/
│   └── web.php
├── src/
│   ├── AarTranslatorServiceProvider.php
│   ├── Console/Commands/           # All CLI commands
│   ├── Dashboard/Controllers/      # Web dashboard
│   ├── Export/                     # Export & Import services
│   ├── Memory/                     # Translation memory
│   ├── Models/                     # Eloquent models
│   ├── Scanners/                   # Project file scanner
│   ├── Services/                   # Core business logic
│   └── Translators/                # AI provider adapters
└── tests/
    ├── Feature/                    # Integration tests
    └── Unit/                       # Unit tests

```

---

Testing
-------

[](#testing)

```
# Run all tests
./vendor/bin/phpunit --testdox

# Run only unit tests
./vendor/bin/phpunit --testsuite Unit --testdox

# Run only feature tests
./vendor/bin/phpunit --testsuite Feature --testdox
```

Tests use **Orchestra Testbench** with an in-memory SQLite database — no external services required.

---

Extending
---------

[](#extending)

### Adding a Custom Translator

[](#adding-a-custom-translator)

Implement `Aar\AutoTranslator\Translators\TranslatorInterface`:

```
use Aar\AutoTranslator\Translators\TranslatorInterface;

class MyCustomTranslator implements TranslatorInterface
{
    public function translate(string $text, string $targetLang, string $sourceLang = 'en'): string
    {
        // your implementation
    }

    public function translateBatch(array $texts, string $targetLang, string $sourceLang = 'en'): array
    {
        return array_map(fn($t) => $this->translate($t, $targetLang, $sourceLang), $texts);
    }

    public function getProviderName(): string
    {
        return 'my-custom-translator';
    }
}
```

---

Changelog
---------

[](#changelog)

See [CHANGELOG.md](CHANGELOG.md) for release history.

---

License
-------

[](#license)

MIT — see [LICENSE](LICENSE) for details.

---

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

[](#contributing)

Pull requests are welcome. For major changes, please open an issue first.

1. Fork the repository
2. Create a feature branch: `git checkout -b feature/my-feature`
3. Commit your changes: `git commit -m 'Add my feature'`
4. Push the branch: `git push origin feature/my-feature`
5. Open a Pull Request

---

Credits
-------

[](#credits)

Built with ❤️ using [Laravel](https://laravel.com), [TailwindCSS](https://tailwindcss.com), and [Alpine.js](https://alpinejs.dev).

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance79

Regular maintenance activity

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60% 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

2

Last Release

113d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9dd59f073898787ab9cab9f17cb46caa589b3fae9ec046c13569c01894e7b630?d=identicon)[ahmed-abdalrazek](/maintainers/ahmed-abdalrazek)

---

Top Contributors

[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (6 commits)")[![ahmed-abdalrazek](https://avatars.githubusercontent.com/u/162600554?v=4)](https://github.com/ahmed-abdalrazek "ahmed-abdalrazek (4 commits)")

---

Tags

laravellocalizationi18ntranslationaitailwindalpine

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/aar-laravel-auto-translator/health.svg)

```
[![Health](https://phpackages.com/badges/aar-laravel-auto-translator/health.svg)](https://phpackages.com/packages/aar-laravel-auto-translator)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9742.3M121](/packages/roots-acorn)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.5k28.4M137](/packages/laravel-cashier)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k14.1M122](/packages/laravel-pulse)[laravel/cashier-paddle

Cashier Paddle provides an expressive, fluent interface to Paddle's subscription billing services.

267880.7k3](/packages/laravel-cashier-paddle)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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