PHPackages                             aureliopons/lagan\_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. aureliopons/lagan\_translate

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

aureliopons/lagan\_translate
============================

Twig function for Illuminate\\Translation\\Translator in Slim framework. Based on dkesberg/slim-twig-translation-extension

08PHP

Since Aug 18Pushed 8y ago1 watchersCompare

[ Source](https://github.com/aureliopons/lagan_translate)[ Packagist](https://packagist.org/packages/aureliopons/lagan_translate)[ RSS](/packages/aureliopons-lagan-translate/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Lagan Translation Extension
===========================

[](#lagan-translation-extension)

This repository provides a twig extension class for the twig view parser. The class adds a translate helper function for the use in twig templates. The translator function tries to call the trans() function of an Illuminate\\Translation\\Translator object in the slim DI container.

Is an adaptation of dkesberg/slim-twig-translation-extension to Slim 3 framework.

Is intended to use with Lagan CMS ()

How to install
--------------

[](#how-to-install)

#### using [Composer](http://getcomposer.org/)

[](#using-composer)

Create a composer.json file in your project root:

```
{
    "require": {
        "aureliopons/lagan_translate": "dev-master"
    }
}
```

Then run the following composer command:

```
$ php composer.phar install
```

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

[](#how-to-use)

### Twig template

[](#twig-template)

In your twig template you would write:

```
  {{ translate('male') }}

```

You can also use the shorthand:

```
  {{ _('male') }}

```

### Adding to Lagan

[](#adding-to-lagan)

At public/index.php add

```
$view->addExtension( new \Aureliopons\Slim\Twig\Extension\TranslationExtension() );
```

And use as a simple injection, using ROOT\_PATH to reference 'lang' folder:

```
use Illuminate\Translation\Translator;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Translation\FileLoader;

$translator = new Translator(new FileLoader(new Filesystem(), ROOT_PATH . '\lang'), 'en');
$translator->setFallback('en');
$app->translator = $translator;
```

Then you can create \\lang\\en folder with your translations array

```
return array(
  'hello'    => 'Hello World!'
);
```

Add new folders for different languages.

###  Health Score

20

—

LowBetter than 12% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7996505?v=4)[Aurelio Pons](/maintainers/aureliopons)[@aureliopons](https://github.com/aureliopons)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/aureliopons-lagan-translate/health.svg)

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

###  Alternatives

[smarty-gettext/smarty-gettext

Gettext plugin enabling internationalization in Smarty Package files

752.5M8](/packages/smarty-gettext-smarty-gettext)[devaslanphp/auto-translate

Auto generate translation JSON files

6627.3k](/packages/devaslanphp-auto-translate)[renatomarinho/laravel-multi-language

Laravel Multi Language

235.1k](/packages/renatomarinho-laravel-multi-language)

PHPackages © 2026

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