PHPackages                             piotr-cz/twig-extensions-joomla - 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. [Templating &amp; Views](/categories/templating)
4. /
5. piotr-cz/twig-extensions-joomla

ActiveLibrary[Templating &amp; Views](/categories/templating)

piotr-cz/twig-extensions-joomla
===============================

Twig - Joomla Framework Language bridge

v1.1.1(12y ago)5361[1 issues](https://github.com/piotr-cz/Twig-extensions-Joomla/issues)MITPHPPHP &gt;=5.3.0

Since Apr 16Pushed 12y ago3 watchersCompare

[ Source](https://github.com/piotr-cz/Twig-extensions-Joomla)[ Packagist](https://packagist.org/packages/piotr-cz/twig-extensions-joomla)[ Docs](https://github.com/piotr-cz/Twig-extensions-Joomla)[ RSS](/packages/piotr-cz-twig-extensions-joomla/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (2)Versions (5)Used By (0)

Twig Extensions - Joomla Framework [![Build Status](https://camo.githubusercontent.com/a5c55c8be58cabc96f9c51930c9198313ef73a4c4fc00bc9ab74d1dd8a969f82/68747470733a2f2f7472617669732d63692e6f72672f70696f74722d637a2f547769672d657874656e73696f6e732d4a6f6f6d6c612e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/piotr-cz/Twig-extensions-Joomla)
===============================================================================================================================================================================================================================================================================================================================================================

[](#twig-extensions---joomla-framework-)

Extensions provide filters to allow using of [Joomla-Framework](http://framework.joomla.org) packages such as [Language package](https://github.com/joomla-framework/language) in [Twig](http://twig.sensiolabs.org) templates.

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

[](#installation)

Add `"piotr-cz/twig-extensions-joomla": "~1.0"` to require block in your composer.json and run `composer install`.

```
{
	"require": {
		"piotr-cz/twig-extensions-joomla": "~1.0"
	}
}
```

Text extension
--------------

[](#text-extension)

It's assumed that you will use Composer to handle autoloading.

### Setup

[](#setup)

Add the extension to the twig environment:

```
// Configure Twig
$loader = new \Twig_Loader_Filesystem(JPATH_TEMPLATES);
$twig = new \Twig_Environment($loader, $options = array());

// Register Extension
$twig->addExtension(new \TwigJoomla\Extension\TextExtension);

// Render Template
$template = $twig->loadTemplate('test.twig');
echo $template->render();
```

### Usage

[](#usage)

Extension is able to call any public method of Text (like `Text::_()`, `Text::sprintf()`, ...).

**Accepted Parameters**

- `$method` Text method
- Text arguments

#### The `_` method (default)

[](#the-_-method-default)

Twig Template:

```
{{ "IMADEIT" | jtext }}
```

Language file:

```
IMADEIT 	= "I made it!"
```

Result:

```
I made it!

```

#### The `sprintf` method

[](#the-sprintf-method)

*Twig template*

```
{{ "HELLOW" | jtext('sprintf', 'World') }}
```

*Language file*

```
HELLOW		="Hello %s!"
```

*Result*

```
Hello World!

```

Date extension
--------------

[](#date-extension)

This extension allows to use localised date output and instead of [PHP intl](http://php.net/intl) extension uses [Language package](https://github.com/joomla-framework/language). Crucial functions imported from of [JDate package](https://github.com/joomla/joomla-platform/blob/staging/libraries/joomla/date/date.php).

### Setup

[](#setup-1)

```
$twig->addExtension(new \Twigoomla\Extension\DateExtension($config->get('timezone')));
```

### Usage

[](#usage-1)

**Accepted Parameters**

- `$format` [DateTime Format](http://cz1.php.net/manual/en/function.date.php)
- `$timezone` String or DateTimeZone object (optional)

*Twig template*

```
{{ event.on | jdate('l, j. F Y') }}
```

*Language File*

```
SUNDAY		="neděle"
JUNE		="červen"
```

*Result*

```
neděle, 1. červen 2014

```

Application setup
-----------------

[](#application-setup)

See [Joomla-Framework/Language](https://github.com/joomla-framework/language) package for instructions on how to setup the `Language` package in your application.

Running tests
-------------

[](#running-tests)

```
$ composer install
$ phpunit
```

Licence
-------

[](#licence)

This extensions are released under the MIT License, except Date extension which is released under GPL2

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 84.6% 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 ~3 days

Total

4

Last Release

4399d ago

Major Versions

0.4.1 → 1.0.02014-04-16

### Community

Maintainers

![](https://www.gravatar.com/avatar/68263721584210e6cd329a0025d50c48be25fc6cfedb9d9f514af2f9f87b0cc6?d=identicon)[mikoweb](/maintainers/mikoweb)

![](https://www.gravatar.com/avatar/04531027d1592929b57822d700d43ea8343edc1f2e0d5e298985491193eaa1fa?d=identicon)[piotr-cz](/maintainers/piotr-cz)

---

Top Contributors

[![piotr-cz](https://avatars.githubusercontent.com/u/612953?v=4)](https://github.com/piotr-cz "piotr-cz (22 commits)")[![mikoweb](https://avatars.githubusercontent.com/u/4729995?v=4)](https://github.com/mikoweb "mikoweb (4 commits)")

---

Tags

i18nlanguagetwigjoomla

### Embed Badge

![Health badge](/badges/piotr-cz-twig-extensions-joomla/health.svg)

```
[![Health](https://phpackages.com/badges/piotr-cz-twig-extensions-joomla/health.svg)](https://phpackages.com/packages/piotr-cz-twig-extensions-joomla)
```

###  Alternatives

[twig/extra-bundle

A Symfony bundle for extra Twig extensions

91292.0M315](/packages/twig-extra-bundle)[twig/intl-extra

A Twig extension for Intl

36663.2M221](/packages/twig-intl-extra)[rcrowe/twigbridge

Adds the power of Twig to Laravel

9105.9M50](/packages/rcrowe-twigbridge)[twig/string-extra

A Twig extension for Symfony String

21946.0M133](/packages/twig-string-extra)[twig/cssinliner-extra

A Twig extension to allow inlining CSS

23018.5M55](/packages/twig-cssinliner-extra)[symfony/ux-twig-component

Twig components for Symfony

21814.8M162](/packages/symfony-ux-twig-component)

PHPackages © 2026

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