PHPackages                             keasy9/laravel-localize - 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. keasy9/laravel-localize

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

keasy9/laravel-localize
=======================

A small Laravel package that helps with site localization.

3.0(2y ago)044MITBladePHP ^7.3 || ^8.0

Since Nov 30Pushed 2y ago1 watchersCompare

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

READMEChangelogDependencies (2)Versions (4)Used By (0)

Laravel-localize - little but usefull package for localisation.
---------------------------------------------------------------

[](#laravel-localize---little-but-usefull-package-for-localisation)

### Installation:

[](#installation)

- composer require keasy9/laravel-localize
- php artisan vendor:publish --provider='Keasy9\\Localize\\Providers\\LocalizeServiceProvider'
- php artisan migrate

### Usage:

[](#usage)

#### Adding uri-prefix:

[](#adding-uri-prefix)

At first you need to add available locales in config/localize.php. By default here is two locales:

```
'available_locales' => [
    'ru' => 'русский',
    'en' => 'english',
],

```

And add prefix for your app's routes:

```
namespace App\Providers;

use Keasy9\Localize\Facades\Localize;

class RouteServiceProvider extends ServiceProvider
{

    public function boot(): void
    {

        $this->routes(function () {
            //...

            Route::middleware('web')
                ->prefix(Localize::getLocalePrefix()) //prefix
                ->group(base_path('routes/web.php'));
        });
    }
}

```

Or in routes/web.php:

```
use Illuminate\Support\Facades\Route;
use Keasy9\Localize\Facades\Localize;

Route::prefix(Localize::getLocalePrefix())->group(function() {
    //...
});

```

#### Localize model fields:

[](#localize-model-fields)

Firstly you need run command `php artisan migrate` that creates table "translations" in your DB. Secondly all models that need translation must use trait and have property:

```
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Keasy9\Localize\Traits\HasTranslations;

class Post extends Model
{
    use HasTranslations;

    // the array must include all fields that can be translated
    public static array $translated = [
        'title',
        'text',
    ];

}

```

so when you try to get a model attribute you will get a translated version of it:

```
{{ $post->title }} {{-- will returns title translated to current app locale --}}

```

Also you can translate all attributes:

```
$post->translate();

```

but be carefully. If you save translated model, fields in your database will be translated:

```
use App/Models/Post;

$post->translate()->save();
dd(Post->find($post->id)->title); //will dump translated title

```

Translate all attributes for all models in collection:

```
$posts->translate();

```

#### Web-interface for editing lang/\*\*.json files and localize models:

[](#web-interface-for-editing-langjson-files-and-localize-models)

This package also provides a simple web interface at http(s)://yourSiteRoot/localize/. But if you need to change this URI, you can do it through the configuration in config/localize.php:

```
'uri' => 'localize',

```

You can also specify a middleware to access that URL or remove it to open access to all users:

```
'access' => ['web','auth'],

```

All models added to the configuration will be available for translation via the web interface:

```
'translated_models' => [
    Post::class
],

```

And you can exclude default locale from editing also in config:

```
'default_locale' => 'en',
'translate_default_locale' => false,

```

Now it's time for you to create an amazing web application!

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

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

Total

3

Last Release

864d ago

Major Versions

1.0 → 2.02023-12-08

2.0 → 3.02023-12-30

### Community

Maintainers

![](https://www.gravatar.com/avatar/7eb9ec2f0e32c390345947d5723845bded82375b999884ffaa4126f73d72ed26?d=identicon)[keasy9](/maintainers/keasy9)

---

Top Contributors

[![keasy9](https://avatars.githubusercontent.com/u/127016754?v=4)](https://github.com/keasy9 "keasy9 (14 commits)")

### Embed Badge

![Health badge](/badges/keasy9-laravel-localize/health.svg)

```
[![Health](https://phpackages.com/badges/keasy9-laravel-localize/health.svg)](https://phpackages.com/packages/keasy9-laravel-localize)
```

###  Alternatives

[mcamara/laravel-localization

Easy localization for Laravel

3.5k9.1M112](/packages/mcamara-laravel-localization)[typicms/base

A modular multilingual CMS built with Laravel, enabling developers to manage structured content like pages, news, events, and more.

1.6k20.3k](/packages/typicms-base)[vemcogroup/laravel-translation

Translation package for Laravel to scan for localisations and up/download to poeditor

135304.0k2](/packages/vemcogroup-laravel-translation)

PHPackages © 2026

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