PHPackages                             almacil/php-translate - 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. almacil/php-translate

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

almacil/php-translate
=====================

1.1.0(2y ago)09641MITPHPPHP &gt;=7.0.0

Since Aug 6Pushed 2y ago1 watchersCompare

[ Source](https://github.com/rubenperezlopez/almacil-php-translate)[ Packagist](https://packagist.org/packages/almacil/php-translate)[ GitHub Sponsors](https://github.com/rubenperezlopez)[ RSS](/packages/almacil-php-translate/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (7)Used By (1)

[![GitHub last commit](https://camo.githubusercontent.com/bfc073bd2c8350401d44f9d42de58295e6ee40d6abcbc3848859503880108f62/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f727562656e706572657a6c6f70657a2f616c6d6163696c2d7068702d7472616e736c617465)](https://camo.githubusercontent.com/bfc073bd2c8350401d44f9d42de58295e6ee40d6abcbc3848859503880108f62/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f727562656e706572657a6c6f70657a2f616c6d6163696c2d7068702d7472616e736c617465)[![GitHub tag (latest by date)](https://camo.githubusercontent.com/5234ece146ddbdeb4c03b030a52bcf1a495e5fd85f6a40db7698c675f111f4a6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f727562656e706572657a6c6f70657a2f616c6d6163696c2d7068702d7472616e736c6174653f6c6162656c3d6c61737425323076657273696f6e)](https://camo.githubusercontent.com/5234ece146ddbdeb4c03b030a52bcf1a495e5fd85f6a40db7698c675f111f4a6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f727562656e706572657a6c6f70657a2f616c6d6163696c2d7068702d7472616e736c6174653f6c6162656c3d6c61737425323076657273696f6e)[![Packagist PHP Version Support](https://camo.githubusercontent.com/2f28b2098a3f2a7344f6ae0059c5d2f3deab604bbbca962b78382a896da2e9b3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f616c6d6163696c2f7068702d7472616e736c617465)](https://camo.githubusercontent.com/2f28b2098a3f2a7344f6ae0059c5d2f3deab604bbbca962b78382a896da2e9b3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f616c6d6163696c2f7068702d7472616e736c617465)[![GitHub](https://camo.githubusercontent.com/965f65efbdb18a04942101d25e18ccae2c045272395eb9a1aececefe2cc84d56/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f727562656e706572657a6c6f70657a2f616c6d6163696c2d7068702d7472616e736c617465)](https://camo.githubusercontent.com/965f65efbdb18a04942101d25e18ccae2c045272395eb9a1aececefe2cc84d56/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f727562656e706572657a6c6f70657a2f616c6d6163696c2d7068702d7472616e736c617465)

🈳 Almacil PHP Translate
=======================

[](#-almacil-php-translate)

This is a library written in PHP to internationalize websites and apps made with PHP.

*Do you want to contribute?*
[![Donate 1€](https://camo.githubusercontent.com/e9f10e402d347eae203f34b35b454643412c5923154e1d43b9475c32c32114cc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4275792532306d6525323061253230636f666665652d312545322538322541432d627269676874677265656e3f6c6f676f3d6275796d6561636f66666565266c6f676f436f6c6f723d7768697465266c6162656c436f6c6f723d67726579267374796c653d666f722d7468652d6261646765)](https://www.paypal.com/paypalme/rubenperezlopez/1?target=_blank)

Features
--------

[](#features)

- Translate from json files
- Translate words or phrases on the fly with *Google Translat*e and store to json files

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

[](#installation)

Installation is possible using Composer

```
composer require almacil/php-translate
```

Usage
-----

[](#usage)

Create an instance of \\Almacil\\Translate:

```
// Require composer autoloader
require __DIR__ . '/vendor/autoload.php';

// Language to translate from auto detectable language
$lang = 'en';

// Directory containing the json files with the translations
$directory = __DIR__ . '/i18n';

// We want the library to search for the translations that it cannot find in the files and to include the translations in the files
$findMissingTranslations = true;

// Create de instance
$translate = new \Almacil\Translate($lang, $directory, $findMissingTranslations);
echo $translate->get('Hola mundo!'); // Hello world!
```

Create a function with a short name for ease:

```
// ... after the setup

function t($text, $params = null) {
    global $translate;
    return $translate->get($text, $params);
}

echo '' . t('Hola mundo!') . ''; // Hello World!
```

Params
------

[](#params)

We can include parameters in translations like this:

```
// ./i18n/en.json
{
    "hola-name": "Hello {{name}}!"
}
```

```
// Some PHP file
echo '' . t('hola-name', array('name' => 'Rubén')) . ''; // Hello Rubén!
```

*Do you want to contribute?*
[![Donate 1€](https://camo.githubusercontent.com/e9f10e402d347eae203f34b35b454643412c5923154e1d43b9475c32c32114cc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4275792532306d6525323061253230636f666665652d312545322538322541432d627269676874677265656e3f6c6f676f3d6275796d6561636f66666565266c6f676f436f6c6f723d7768697465266c6162656c436f6c6f723d67726579267374796c653d666f722d7468652d6261646765)](https://www.paypal.com/paypalme/rubenperezlopez/1?target=_blank)

---

Made with ❤️ by developer for developers

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity51

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

Every ~159 days

Recently: every ~199 days

Total

6

Last Release

994d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5f0782da3f221895ff5593718ad68bf60aacf897dffb9dc462929346fc16e105?d=identicon)[rubenperezlopez](/maintainers/rubenperezlopez)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/almacil-php-translate/health.svg)

```
[![Health](https://phpackages.com/badges/almacil-php-translate/health.svg)](https://phpackages.com/packages/almacil-php-translate)
```

###  Alternatives

[smmoosavi/php-gettext

Wrapper for php-gettext by danilo segan. This library provides PHP functions to read MO files even when gettext is not compiled in or when appropriate locale is not present on the system.

1927.0k1](/packages/smmoosavi-php-gettext)

PHPackages © 2026

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