Download the PHP package abedmaatalla/slim-twig-translation without Composer
On this page you can find all versions of the php package abedmaatalla/slim-twig-translation. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download abedmaatalla/slim-twig-translation
More information about abedmaatalla/slim-twig-translation
Files in abedmaatalla/slim-twig-translation
Package slim-twig-translation
Short Description Twig function for Illuminate\Translation\Translator in Slim framework
License MIT
Homepage http://github.com/abedmaatalla/slim-twig-translation
Informations about the package slim-twig-translation
Slim Twig Translation
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.
How to install
using Composer
Create a composer.json file in your project root:
Then run the following composer command:
How to use
Create new folder for langauges
+ -- lang
- -- en
- -- file.php
- -- fr
- -- file.php
Tanslator
Set up your Tansloator
Slim
Set up your twig views as described in the SlimViews Repository. Add the extension to your parser extensions.
Twig template
In your twig template you would write:
You can also use the shorthand:
You can also use the shorthand:
All versions of slim-twig-translation with dependencies
slim/slim Version >=2.3.0
slim/views Version >=0.1.2
twig/twig Version >=1.16.0
illuminate/translation Version >=4.0