PHPackages                             chinleung/laravel-locales - 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. chinleung/laravel-locales

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

chinleung/laravel-locales
=========================

Add configurations and helpers for a multi locale application.

v3.0.0(2mo ago)36227.4k↓42.2%34MITPHPPHP ^8.3CI failing

Since Jul 30Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/chinleung/laravel-locales)[ Packagist](https://packagist.org/packages/chinleung/laravel-locales)[ Docs](https://github.com/chinleung/laravel-locales)[ RSS](/packages/chinleung-laravel-locales/feed)WikiDiscussions v3 Synced 2d ago

READMEChangelog (10)Dependencies (6)Versions (21)Used By (4)

Laravel Locales
===============

[](#laravel-locales)

[![Latest Version on Packagist](https://camo.githubusercontent.com/7af8da8c6177218aa40f70c77ef5fb51455aa7aee4d7039404a854acd45c50a3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6368696e6c65756e672f6c61726176656c2d6c6f63616c65732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/chinleung/laravel-locales)[![Build Status](https://github.com/chinleung/laravel-locales/workflows/tests/badge.svg?branch=v2)](https://github.com/chinleung/laravel-locales/actions?query=workflow%3Atests)[![Quality Score](https://camo.githubusercontent.com/8a8dfd63db351bbd7454af55f5740a18719e5728c6bedf3f8efd7c9a7b9eca27/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6368696e6c65756e672f6c61726176656c2d6c6f63616c65732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/chinleung/laravel-locales)[![Total Downloads](https://camo.githubusercontent.com/650f7dad9d6788a47b14a6fc6dfaeabf6b902bacf4cf059b9c05652a1608c61b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6368696e6c65756e672f6c61726176656c2d6c6f63616c65732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/chinleung/laravel-locales)

Add configurations and helpers to make an application support multiple locales.

Versions
--------

[](#versions)

PackageLaravelPHP3.x13.x^8.32.x9.x–12.x^8.01.x6.x–8.x^7.4Installation
------------

[](#installation)

You can install the package via composer:

```
composer require chinleung/laravel-locales
```

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

[](#configuration)

By default, the application locales is only going to be `en`. If your application support other locales, you can either set a `app.locales` in your `config/app.php` or publish the configuration file:

```
php artisan vendor:publish --provider="ChinLeung\LaravelLocales\LaravelLocalesServiceProvider" --tag="config"
```

Helpers
-------

[](#helpers)

### locale(string $locale = null) : string

[](#localestring-locale--null--string)

> Retrieve or update the current locale of the application.

```
// Alias of app()->getLocale();
locale(); // 'en'

// Alias of app()->setLocale('fr');
locale('fr'); // 'fr'
locale(); // 'fr'
```

### locales(array $locales = null) : array

[](#localesarray-locales--null--array)

> Retrieve or update the supported locales of the application.
> Has priority for `app.locales` over `laravel-locales.supported`.

```
locales(); // ['en']

locales(['en', 'fr', 'zh']);
locales(); // ['en', 'fr', 'zh']

locales(['en', 'zh']);
locales(); // ['en', 'zh']
```

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

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

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

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

Credits
-------

[](#credits)

- [Chin Leung](https://github.com/chinleung)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

Laravel Package Boilerplate
---------------------------

[](#laravel-package-boilerplate)

This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).

###  Health Score

62

—

FairBetter than 99% of packages

Maintenance83

Actively maintained with recent releases

Popularity45

Moderate usage in the ecosystem

Community22

Small or concentrated contributor base

Maturity83

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 78.3% 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 ~128 days

Recently: every ~89 days

Total

20

Last Release

87d ago

Major Versions

v1.x-dev → v2.0.02022-02-14

v2.x-dev → v3.0.02026-04-08

PHP version history (5 changes)v1.0.0PHP ^7.1

v1.2.2PHP ^7.1|^8.0

v1.x-devPHP ^7.1|^8.0|^8.1

v2.0.0PHP ^8.0|^8.1

v3.0.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/40590fe8b8c82dfac2530c6f0c0c39dd1dded4c3ad136e15ef2cf3bb20304dad?d=identicon)[ChinLeung](/maintainers/ChinLeung)

---

Top Contributors

[![chinleung](https://avatars.githubusercontent.com/u/19669331?v=4)](https://github.com/chinleung "chinleung (47 commits)")[![greatislander](https://avatars.githubusercontent.com/u/605361?v=4)](https://github.com/greatislander "greatislander (7 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (3 commits)")[![apiaget](https://avatars.githubusercontent.com/u/634083?v=4)](https://github.com/apiaget "apiaget (1 commits)")[![fyrts](https://avatars.githubusercontent.com/u/5918336?v=4)](https://github.com/fyrts "fyrts (1 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (1 commits)")

---

Tags

composer-packagelaravellocalizationpackagechinleunglaravel-locales

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/chinleung-laravel-locales/health.svg)

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

###  Alternatives

[illuminate/translation

The Illuminate Translation package.

6938.0M571](/packages/illuminate-translation)[chinleung/laravel-multilingual-routes

A package to register multilingual routes.

447213.2k2](/packages/chinleung-laravel-multilingual-routes)[erag/laravel-lang-sync-inertia

A powerful Laravel package for syncing and managing language translations across backend and Inertia.js (Vue/React/Svelte) frontends, offering effortless localization, auto-sync features, and smooth multi-language support for modern Laravel applications.

4925.3k](/packages/erag-laravel-lang-sync-inertia)

PHPackages © 2026

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