PHPackages                             administrcms/localization - 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. administrcms/localization

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

administrcms/localization
=========================

0.1(6y ago)01.1k1[1 PRs](https://github.com/administrcms/localization/pulls)2PHPPHP &gt;=5.5.9

Since Jun 29Pushed 2y ago1 watchersCompare

[ Source](https://github.com/administrcms/localization)[ Packagist](https://packagist.org/packages/administrcms/localization)[ RSS](/packages/administrcms-localization/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (5)Dependencies (1)Versions (7)Used By (2)

Localization package for AdministrCMS
=====================================

[](#localization-package-for-administrcms)

Although it is written to work with the aministr package, you can use this one as a standalone with Laravel 5.2.

It is still a work-in-progress.

Installation
============

[](#installation)

Using [Composer](https://getcomposer.org/):

```
composer require administrcms/localization

```

Add the service provider:

```
\Administr\Localization\LocalizationServiceProvider::class,
```

The Facade:

```
'Locale'    => \Administr\Localization\LocalizationFacade::class,
```

Register the middleware in your App Kernel and be sure that the session middleware is registered before it:

```
\Administr\Localization\LocalizationMiddleware::class,
```

What it does
============

[](#what-it-does)

It basically checks and persist the current language in a session and it assumes that you are using a parameter for the language in your routes. If you are using a diffrent method for changing languages, you can register your own middleware and utilize the Localizator class included in this package.

Also it creates a table for storing the available languages and has a Language model under the namespace `Administr\Localization\Language`. If you have multilingual data in your db, it also provides a `Translatable` model, which extends the base Eloquent model and adds functionality for translations.

Usage of translatable models
============================

[](#usage-of-translatable-models)

You will have to create two tables - one that stores the main model data that is not translatable and a second that will hold the translations.

They can look something like this:

```
Schema::create('people', function (Blueprint $table) {
    $table->increments('id');
    $table->boolean('is_visible')->default(0);
    $table->timestamps();
});

Schema::create('people_translations', function (Blueprint $table) {
    $table->increments('id');
    $table->integer('language_id')->unsigned();
    $table->integer('person_id')->unsigned();

    $table->string('name', 100);
    $table->string('position', 100);

    $table->timestamps();

    $table->foreign('language_id')->references('id')->on('administr_languages')->onDelete('cascade');
    $table->foreign('person_id')->references('id')->on('people')->onDelete('cascade');
});
```

And the corresponding models:

```
// Person.php

namespace App\Models;

use Administr\Localization\Models\Translatable;

class Person extends Translatable
{
    protected $table = 'people';
    protected $fillable = ['is_visible', 'name', 'position'];
    protected $translatable = ['name', 'position'];
}

// PersonTranslation.php

use Illuminate\Database\Eloquent\Model;

class PersonTranslation extends Model
{
    protected $table = 'people_translations';
    protected $fillable = ['language_id', 'name', 'position'];
}
```

And then in your app code:

```
 // Get the first model with translation in the current app locale
$person = Person::translated()->first();

 // Translated in the language with id of 1
$person = Person::translated(1)->first();

// Translated in the language with code of 'bg'.
// Have in mind that when you do it like this,
// an additional query will be made to find the language id.
$person = Person::translated('bg')->first();

$person->name; // You can access the translation model properties through the main model

// Create an instance of the main model
// with a translation in the current locale.
// If you do not pass translatable fields,
// only the main model will be persisted.
Person::create([
    'name'      => 'Miroslav Vitanov',
    'position'  => 'Developer',
]);

// Updates the model and the translation that was
// created in the current locale.
Person::find(1)->update([
    'name'      => 'Miroslav Vitanov',
    'position'  => 'PHP Developer',
]);

// Translate a model in another language.
// You can pass a locale code or language id.
Person::find(1)->translate('bg')
->fill([
   'name'      => 'Мирослав Витанов',
   'position'  => 'Програмист',
])
->save();

// Check if any translations exist
$person->hasTranslations();

// Check if a translation with language id exists
$person->isTranslatedIn(1);

// Get all translations
$person->translations;

// When a model is serialized to an array,
// it will include the current translation
$person->toArray();
```

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity52

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

Total

5

Last Release

2441d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/909813?v=4)[Miroslav Vitanov](/maintainers/mirovit)[@mirovit](https://github.com/mirovit)

---

Top Contributors

[![mirovit](https://avatars.githubusercontent.com/u/909813?v=4)](https://github.com/mirovit "mirovit (44 commits)")

### Embed Badge

![Health badge](/badges/administrcms-localization/health.svg)

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

###  Alternatives

[backpack/crud

Quickly build admin interfaces using Laravel, Bootstrap and JavaScript.

3.4k3.7M220](/packages/backpack-crud)[typicms/base

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

1.6k20.4k](/packages/typicms-base)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135224.7k7](/packages/statamic-rad-pack-runway)[vemcogroup/laravel-translation

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

136327.1k3](/packages/vemcogroup-laravel-translation)

PHPackages © 2026

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