PHPackages                             mmqfilho/languages - 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. mmqfilho/languages

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

mmqfilho/languages
==================

class to use multiple translation files

1.2.4(8y ago)025GPLv2PHPPHP &gt;=5.3.0

Since Oct 19Pushed 8y ago1 watchersCompare

[ Source](https://github.com/mmqfilho/languages)[ Packagist](https://packagist.org/packages/mmqfilho/languages)[ Docs](https://github.com/mmqfilho/languages)[ RSS](/packages/mmqfilho-languages/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)DependenciesVersions (7)Used By (0)

Class Languages
===============

[](#class-languages)

version: `1.2.4`

date: `2017/10/17`

Author: `Marcos Menezes `

Directory structure
-------------------

[](#directory-structure)

```
| your_project_root
|-# class (class folder)
| |-# Mmqfilho
|   |-# Languages
|     |- Language.php (class file)
|
|-# languages (language folder)
| |-# en (english language folder)
| | |- your english language files
| |
| |-# pt-br (brazilian portuguese language folder)
| | |- your brazilian portuguese language files
| |
| |-# xxxx (other languages folder)
|   |- others language files

```

How to use
----------

[](#how-to-use)

include the file and set the namespace

```
include_once 'class/Mmqfilho/Languages/Language.php';
or use autoload composer
include_once YOUR_VENDOR_DIR . '/autoload.php' ;

use mmqfilho\Languages\Language as Lang;

```

Create object

```
$objLang = new Lang();

```

Or create object and set language to use

```
$objLang = new Lang('en');

```

Or use setter

```
$objLang->__set('default_language', 'en');

```

(optional) Setting the language folder if necessary (without slashes in the end)

```
$objLang->__set('directory', 'path/to/your/language/folder');

```

(optional) Show or not a message if not found the text

```
$objLang->__set('show_message_not_found', true);

```

(optional) The message to show if not found the text

```
$objLang->__set('message_not_found', 'I dont like default message');

```

(optional) number of recursive attempts in directories to find the language files (3 is the default)

```
$objLang->__set('recursiveDirCount', 3);

```

(optional) set the file type to load (json or xml) (json is the default file type)

```
$objLang->setXml();
or
$objLang->setJson();

```

Show the text

- Param 1 is the name of xml file without the '.xml'
- Param 2 is the name of xml tag
- Param 3 (optional) is a variables array

```
echo $objLang->load('index', 'welcome');
or with an array with one or many variables
echo $objLang->load('index', 'yourName', array('Marcos'));
echo $objLang->load('index', 'yourFullName', array('Marcos', 'Menezes'));

```

The XML files
-------------

[](#the-xml-files)

In the tag `` put your own translation tags

If you use a html tag or special caracteres put into CDATA tag.

If you use a variable to send a parameter, put the '%s' in the tag

```

	Welcome
	Warning: Welcome %s.]]>

```

The JSON files
--------------

[](#the-json-files)

If you use a variable to send a parameter, put the '%s' in the tag

```
{
	"welcome": "Welcome to json version",
	"welcomeTag": "Warning: Welcome json.",
	"version": "Version: %s"
}

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

Established project with proven stability

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

Recently: every ~90 days

Total

6

Last Release

3126d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3c42dfe3ae4731d2a59d03f8286aade3209fc6744567b9b5fb7c9813d48f232f?d=identicon)[mmqfilho](/maintainers/mmqfilho)

---

Top Contributors

[![mmqfilho](https://avatars.githubusercontent.com/u/7557265?v=4)](https://github.com/mmqfilho "mmqfilho (27 commits)")

---

Tags

translationfilesmultiple

### Embed Badge

![Health badge](/badges/mmqfilho-languages/health.svg)

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

###  Alternatives

[gettext/gettext

PHP gettext manager

70530.2M100](/packages/gettext-gettext)[inpsyde/multilingual-press

Simply THE multisite-based free open source plugin for your multilingual websites.

2414.0k1](/packages/inpsyde-multilingual-press)[wcm/wcm-lang-switch

Adds a button to the admin toolbar. This buttons allows users to seamlessly switch between available languages..

212.0k](/packages/wcm-wcm-lang-switch)

PHPackages © 2026

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