PHPackages                             webklex/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. [PDF &amp; Document Generation](/categories/documents)
4. /
5. webklex/translator

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

webklex/translator
==================

Flexible Laravel translator based on .CSV language files

1.0.5.1(9y ago)3274MITPHPPHP &gt;=5.5.9

Since Sep 24Pushed 9y ago1 watchersCompare

[ Source](https://github.com/Webklex/translator)[ Packagist](https://packagist.org/packages/webklex/translator)[ Docs](https://github.com/webklex/translator)[ RSS](/packages/webklex-translator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (8)Versions (10)Used By (0)

Translator (CSV File based)
===========================

[](#translator-csv-file-based)

[![Latest Version on Packagist](https://camo.githubusercontent.com/533a8a8bc834e4ae4e7a005478ed23c6db967cde6f8ce2803d66d76fca341271/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f5765626b6c65782f5472616e736c61746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/Webklex/Translator)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/0e734986aa51ffe20c03971305ddc02c7daa679e1ad75306e10221c3f98a4194/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f5765626b6c65782f7472616e736c61746f722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/Webklex/Translator)[![Total Downloads](https://camo.githubusercontent.com/beb96765150e227056bbc3525bbb87e523671263d6ecb5884d30cc0fbe04b6ec/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f5765626b6c65782f5472616e736c61746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/Webklex/Translator)

This is a translator package provides everything you need to get started with a quiet fast CSV file based translation service.

Install
-------

[](#install)

Via Composer

```
$ composer require webklex/translator
```

Setup
-----

[](#setup)

Add the service provider to the providers array in `config/app.php`.

```
'providers' => [
    Webklex\Translator\Providers\TranslatorServiceProvider::class,
    Webklex\Translator\Providers\TranslatorBladeServiceProvider::class,
];
```

Middleware
----------

[](#middleware)

You may want to use the middleware in order to control the global language setup inside `app/Http/Kernel.php`.

```
protected $routeMiddleware = [
    'translator' => Webklex\Translator\Middleware\TranslatorMiddleware::class,
];
```

Routes and language switching
-----------------------------

[](#routes-and-language-switching)

If you want to change the system language by clicking on a link, you could use something like this:

Inside your controller:

```
/**
 * Change the current language
 *
 * @param string $locale
 * @return \Illuminate\Http\RedirectResponse
 */
public function changeLanguage($locale){
    if(in_array($locale, config('translator.available'))){
        Session::put('locale', $locale);
        Session::save();
        app()->setLocale($locale);
    }

    return redirect()->back();
}
```

Inside your routing file:

```
Route::get('/language/{locale}', 'YourControllerName@changeLanguage');
```

Publishing
----------

[](#publishing)

You can publish everything at once

```
php artisan vendor:publish --provider="Webklex\Translator\Providers\TranslatorServiceProvider"
```

or you can publish groups individually.

```
php artisan vendor:publish --provider="Webklex\Translator\Providers\TranslatorServiceProvider" --tag="config"
```

Usage
-----

[](#usage)

This is a translator package provides everything you need to get started with a quiet fast CSV file based translation service. Your translation files will be stored by default in `resources/lang/` your language code (e.g. `en`) `/default.csv`.

Access Translator by its Facade (Webklex\\Translator\\Facades\\TranslatorFacade). Therefor you might want to add an alias to the aliases array within the `config/app.php` file.

```
'aliases' => [
    'Lang' => Webklex\Translator\Facades\TranslatorFacade::class
];
```

You registered the TranslatorBladeServiceProvider you can even use this easy shorthand directive.

```
@t('My translation')
@t('My translation', 'en')
```

If you are using something like my other package `webklex/helpers` you can use a helper function to make the access even easier.

Therefor create a new helper: `php artisan make:helper translator` and edit the `app/Helpers/translator.php`.

```
if (!function_exists('_t')) {

    /**
     * Shorthand translation
     * @param string $string
     * @param string $locale
     *
     * @return string
     */
    function _t($string, $locale = null)
    {
        return Webklex\Translator\Facades\TranslatorFacade::get($string, $locale);
    }
}
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Security
--------

[](#security)

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

Credits
-------

[](#credits)

- [Webklex](https://github.com/webklex)
- All Contributors

License
-------

[](#license)

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

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

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

Recently: every ~17 days

Total

9

Last Release

3300d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/33ae6b4339438c4901fa8ed581119bbca61d071907f308ea8e9af597ae69f08a?d=identicon)[webklex](/maintainers/webklex)

---

Top Contributors

[![Webklex](https://avatars.githubusercontent.com/u/2884144?v=4)](https://github.com/Webklex "Webklex (13 commits)")

---

Tags

csvlanguagelaravellibrarymultilanguagephplaravellanguagecsvtranslatormultilangwebklex

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/webklex-translator/health.svg)

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

###  Alternatives

[maatwebsite/excel

Supercharged Excel exports and imports in Laravel

12.7k144.3M706](/packages/maatwebsite-excel)[laravel/pulse

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

1.7k12.1M99](/packages/laravel-pulse)[proengsoft/laravel-jsvalidation

Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest

1.1k2.3M49](/packages/proengsoft-laravel-jsvalidation)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[propaganistas/laravel-disposable-email

Disposable email validator

5762.6M6](/packages/propaganistas-laravel-disposable-email)[andreaselia/laravel-api-to-postman

Generate a Postman collection automatically from your Laravel API

1.0k586.2k3](/packages/andreaselia-laravel-api-to-postman)

PHPackages © 2026

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