PHPackages                             miladul/laravel-multilang - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. miladul/laravel-multilang

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

miladul/laravel-multilang
=========================

A simple multi-language package for Laravel using JSON files.

v1.0.0(10mo ago)12MITPHPPHP &gt;=8.0

Since Sep 1Pushed 10mo agoCompare

[ Source](https://github.com/miladul/laravel-multilang)[ Packagist](https://packagist.org/packages/miladul/laravel-multilang)[ RSS](/packages/miladul-laravel-multilang/feed)WikiDiscussions main Synced today

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

Laravel Multilang
=================

[](#laravel-multilang)

A simple multilingual package for Laravel to manage translations easily using JSON language files.

---

📦 Installation
--------------

[](#-installation)

You can install this package directly from GitHub.

### 1. Add the repository to your

[](#1-add-the-repository-to-your)

`composer.json`:

```
"repositories": [
    {
        "type": "git",
        "url": "https://github.com/miladul/laravel-multilang.git"
    }
]

```

### 2. Require the package using Composer:

[](#2-require-the-package-using-composer)

```
composer require miladul/laravel-multilang:dev-main

```

3. Publish the configuration and language files:
------------------------------------------------

[](#3-publish-the-configuration-and-language-files)

```
php artisan vendor:publish --tag=multilang

```

This will create the default language files in resources/lang.

### 🌐 Language Files

[](#-language-files)

Language files are stored as JSON files in resources/lang. like:

```
resources/lang/
├── en.json      # English
├── bn.json      # Bengali
├── cn.json      # Chinese
└── in.json      # Hindi/India

```

### Example en.json:

[](#example-enjson)

```
{
    "welcome": "Welcome to our website",
    "goodbye": "Goodbye"
}
```

### Example bn.json

[](#example-bnjson)

```
{
    "welcome": "আমাদের ওয়েবসাইটে স্বাগতম",
    "goodbye": "বিদায়!"
}

```

🚀 Usage
-------

[](#-usage)

### Using the mlang helper function:

[](#using-the-mlang-helper-function)

```
echo mlang('welcome'); // Outputs translation based on current locale

```

### Using Laravel’s standard \_\_ helper function:

[](#using-laravels-standard-__-helper-function)

```
{{ __('goodbye') }}

```

#### Both methods work the same way. mlang() is just a shortcut for convenience.

[](#both-methods-work-the-same-way-mlang-is-just-a-shortcut-for-convenience)

🌍 Changing Locale
-----------------

[](#-changing-locale)

```

app()->setLocale('en') // Switch to English
app()->setLocale('bn')  // Switch to Bengali
app()->setLocale('cn')  // Switch to Chinese
app()->setLocale('in')  // Switch to Hindi/India

```

✏️ Adding or Updating Translations
----------------------------------

[](#️-adding-or-updating-translations)

1. Open the language JSON file for the desired locale, e.g., resources/lang/bn.json.
2. Add new key-value pairs or update existing ones.
3. you can add new file that must be match with your locale. eg: `ar.json for arabic language`
4. Run `php artisan config:clear` to clear the configuration cache.

### Example: bn.json

[](#example--bnjson)

```
{
    "welcome": "আমাদের ওয়েবসাইটে স্বাগতম",
    "goodbye": "বিদায়!",
    "contact_us": "যোগাযোগ করুন" //new one
}

```

📝 Summary
---------

[](#-summary)

1. Install via Composer from GitHub.
2. Publish language files with php artisan vendor:publish --tag=multilang.
3. Use mlang('key') or \_\_('key') to get translations.
4. Manage translations via JSON files in resources/lang.
5. Dynamically switch locale using App::setLocale('locale').

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance54

Moderate activity, may be stable

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

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

Unknown

Total

1

Last Release

305d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/49594190?v=4)[Miladul Islam](/maintainers/miladul)[@miladul](https://github.com/miladul)

---

Top Contributors

[![miladul](https://avatars.githubusercontent.com/u/49594190?v=4)](https://github.com/miladul "miladul (2 commits)")

---

Tags

jsonlaravelmulti-language

### Embed Badge

![Health badge](/badges/miladul-laravel-multilang/health.svg)

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

###  Alternatives

[unopim/unopim

UnoPim Laravel PIM

10.5k2.4k](/packages/unopim-unopim)[api-platform/laravel

API Platform support for Laravel

58171.4k14](/packages/api-platform-laravel)[ecotone/laravel

Ecotone for Laravel — CQRS, Event Sourcing, Sagas, Durable Workflows, and Outbox on top of Laravel Queue, via PHP attributes.

21318.6k3](/packages/ecotone-laravel)

PHPackages © 2026

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