Package for convenient work with Laravel's localization features

v1.1.1 2019-07-13 03:15 UTC

This package is auto-updated.

Last update: 2024-06-13 14:09:26 UTC


Localization Helper

Package for convenient work with Laravel's localization features and fast language files generation.

Coverage report Last version Build status Downloads License CDN Ready laravel Last commit Analytics Hosted by Package Kit Patreon

Localization Helper


Via Composer

$ composer require awes-io/localization-helper

In Laravel 5.5+, service provider and facade will be automatically registered. For older versions, follow the steps below:

Register service provider in config/app.php:

'providers' => [
// [...]

You may also register LaravelLocalization facade:

'aliases' => [
// [...]
        'LocalizationHelper' => AwesIO\LocalizationHelper\Facades\LocalizationHelper::class,


Config Files

In order to edit default configuration you may execute:

php artisan vendor:publish --provider="AwesIO\LocalizationHelper\LocalizationHelperServiceProvider"

After that, config/localizationhelper.php will be created.


Localization Helper

Package registers global helper function _p($file_key, $default, $placeholders):

_p('auth.login', 'Login'); // "Login"

It will create new localization file auth.php (if it doesn't exist) and write second parameter as language string under login key:

return [
    "login" => "Login"

On second call with same file/key _p('auth.login'), localization string will be returned, file will remain untouched.

Placeholders are also supported:

    'You’re invited to join :company company workspace', 
    ['company' => 'Awesio']

If key is returned, it means that string already exists in localization file and you are trying to add new one using its value as an array.

// in localization file.php
return [
    "test" => "Test string"

_p('', 'Test string'); // will return ""

_p('', 'Test string'); // will return "Test string"

// and modify localization file:
return [
    "test" => "Test string",
    "test_2" => [
        "new" => "Test string"

Change log

Please see the changelog for more information on what has changed recently.


The coverage of the package is Coverage report.

You can run the tests with:

composer test


Please see for details and a todolist.