PHPackages                             manujoz/translation - 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. manujoz/translation

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

manujoz/translation
===================

Class for create multilanguage sites o PHP

1.0.0(5y ago)0112MITPHPPHP &gt;=5.5.0

Since Oct 13Pushed 5y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (2)Used By (0)

Translation
===========

[](#translation)

Translation is a PHP class used to create or manage multilanguage sites.

Install
-------

[](#install)

```
$ composer require manujoz/translation

```

Use
---

[](#use)

You need to create the files that will contain the translations of the texts. Normally we will use a folder called "locales".

In this folder you will create a file for each language you want the translation of.

```
|ROOT
	|_	locales
	|		   |_ en-US.php
	|		   |_ es-ES.php
	|		   |_ fr-FR.php
	|_	index.php

```

Locale file example:

locales/en-US.php

```

```

locales/es-ES.php

```

```

Once you have created the translation files, the use is very simple:

index.php

```

```

Documentation
-------------

[](#documentation)

### Constructor

[](#constructor)

When the class is initialized you can pass as a parameter the path to the folder where your translation files are located. By default it will look in the root folder for a folder called "locales", but if you prefer to save it in different folders for example "translates/section1 /", "translates/section2", you can tell the class where to look for the translation files:

```
|ROOT
	|_	translates
	|		   |_ section1
	|		   |          |_ en-US.php
	|		   |          |_ es-ES.php
	|		   |          |_ fr-FR.php
	|		   |_ section2
	|		   |          |_ en-US.php
	|		   |          |_ es-ES.php
	|		   |          |_ fr-FR.php
	|_	index.php

```

```

```

Keep in mind that you will have to enter the path relative to the root folder. In this way you can create translation files by sections of your site for example or organize them as you want.

### of() method

[](#of-method)

With the ***of()*** method we perform the translations, this method admits two parameters:

```
$TRANS->of( $key, $params = array() );
```

#### $key

[](#key)

It is the key of the array that will search the file to return the corresponding text.

#### $params (Optional)

[](#params-optional)

It is an array with the words that can be added to a text as seen in the example above.

### set\_enclosing\_chars() method

[](#set_enclosing_chars-method)

By default, in the text of the translations file, use these keys {} as encapulation characters. But if you prefer to change the encapsulation characters for some reason you can do it with the following method:

```

```

locales/en-US.php

```

```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

2034d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4c2f495723a53d0ec4417be418c3768b0fff52cbed64762c49e535e15b13441c?d=identicon)[manujoz](/maintainers/manujoz)

---

Top Contributors

[![manujoz](https://avatars.githubusercontent.com/u/24960688?v=4)](https://github.com/manujoz "manujoz (3 commits)")

### Embed Badge

![Health badge](/badges/manujoz-translation/health.svg)

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

###  Alternatives

[symfony/translation

Provides tools to internationalize your application

6.6k836.5M2.0k](/packages/symfony-translation)[nesbot/carbon

An API extension for DateTime that supports 281 different languages.

169661.4M4.8k](/packages/nesbot-carbon)[joedixon/laravel-translation

A tool for managing all of your Laravel translations

717911.4k11](/packages/joedixon-laravel-translation)[illuminate/translation

The Illuminate Translation package.

6936.4M491](/packages/illuminate-translation)[lajax/yii2-translate-manager

Translation management extension for Yii 2

227578.8k13](/packages/lajax-yii2-translate-manager)[larswiegers/laravel-translations-checker

Make sure your laravel translations are checked and are included in all languages.

256423.2k2](/packages/larswiegers-laravel-translations-checker)

PHPackages © 2026

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