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.

v2.2.2(1y ago)36205.3k—3.8%3[1 PRs](https://github.com/chinleung/laravel-locales/pulls)4MITPHPPHP ^8.0|^8.1CI failing

Since Jul 30Pushed 1y 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 v2 Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (19)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.

Installation
------------

[](#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

51

—

FairBetter than 96% of packages

Maintenance47

Moderate activity, may be stable

Popularity45

Moderate usage in the ecosystem

Community21

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 77.6% 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 ~123 days

Recently: every ~94 days

Total

18

Last Release

395d ago

Major Versions

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

PHP version history (4 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

### 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 (45 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

[chinleung/laravel-multilingual-routes

A package to register multilingual routes.

442195.4k2](/packages/chinleung-laravel-multilingual-routes)[vluzrmos/language-detector

Detect the language for your application using browser preferences, subdomains or route prefixes.

109554.8k3](/packages/vluzrmos-language-detector)[kerigard/laravel-lang-ru

Ru lang for Laravel

2116.8k](/packages/kerigard-laravel-lang-ru)[highsolutions/laravel-translation-manager

Manage Laravel Translations

1518.8k](/packages/highsolutions-laravel-translation-manager)[amendozaaguiar/laraveles-spanish-for-jetstream

Archivos de traducción al español latinoamericano para Laravel con Jetstream (auth, pagination, passwords, validation + todas las cadenas de Jetstream).

1412.1k](/packages/amendozaaguiar-laraveles-spanish-for-jetstream)

PHPackages © 2026

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