PHPackages                             umpirsky/twig-gettext-extractor - 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. umpirsky/twig-gettext-extractor

ActiveApplication

umpirsky/twig-gettext-extractor
===============================

The Twig Gettext Extractor is Poedit friendly tool which extracts translations from twig templates.

v1.3.1(7y ago)114376.2k↑13%29[6 PRs](https://github.com/umpirsky/Twig-Gettext-Extractor/pulls)1MITPHPPHP ^7.1

Since Aug 29Pushed 7y ago7 watchersCompare

[ Source](https://github.com/umpirsky/Twig-Gettext-Extractor)[ Packagist](https://packagist.org/packages/umpirsky/twig-gettext-extractor)[ RSS](/packages/umpirsky-twig-gettext-extractor/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (10)Versions (14)Used By (1)

###  [ ![](https://camo.githubusercontent.com/4acdbd12ae1b9a9539be7b30f8cef6cd9678ccb45500067152e333743632afd8/68747470733a2f2f6661726d322e737461746963666c69636b722e636f6d2f313730392f32353039383532363838345f616534643530343635665f6f5f642e706e67) ](https://github.com/umpirsky)

[](#----------------)

 [symfony upgrade fixer](https://github.com/umpirsky/Symfony-Upgrade-Fixer) • **twig gettext extractor** • [wisdom](https://github.com/umpirsky/wisdom) • [centipede](https://github.com/umpirsky/centipede) • [permissions handler](https://github.com/umpirsky/PermissionsHandler) • [extraload](https://github.com/umpirsky/Extraload) • [gravatar](https://github.com/umpirsky/Gravatar) • [locurro](https://github.com/umpirsky/locurro) • [country list](https://github.com/umpirsky/country-list) • [transliterator](https://github.com/umpirsky/Transliterator)

Twig Gettext Extractor [![Build Status](https://camo.githubusercontent.com/10aad5045ae1dc415be269d7f5ed4f9b60e9c64a6eb76e98508f5937767a6057/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f756d706972736b792f547769672d476574746578742d457874726163746f722e7376673f6272616e63683d6d6173746572)](http://travis-ci.org/umpirsky/Twig-Gettext-Extractor)
================================================================================================================================================================================================================================================================================================================================================================

[](#twig-gettext-extractor-)

The Twig Gettext Extractor is [Poedit](http://www.poedit.net/download.php)friendly tool which extracts translations from twig templates.

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

[](#installation)

### Manual

[](#manual)

#### Local

[](#local)

Download the `twig-gettext-extractor.phar` file and store it somewhere on your computer.

#### Global

[](#global)

You can run these commands to easily access `twig-gettext-extractor` from anywhere on your system:

```
$ sudo wget https://github.com/umpirsky/Twig-Gettext-Extractor/releases/download/1.2.0/twig-gettext-extractor.phar -O /usr/local/bin/twig-gettext-extractor
$ sudo chmod a+x /usr/local/bin/twig-gettext-extractor
```

Then, just run `twig-gettext-extractor`.

### Composer

[](#composer)

#### Local

[](#local-1)

```
$ composer require umpirsky/twig-gettext-extractor
```

#### Global

[](#global-1)

```
$ composer global require umpirsky/twig-gettext-extractor
```

Make sure you have `~/.composer/vendor/bin` in your `PATH` and you're good to go:

```
$ export PATH="$PATH:$HOME/.composer/vendor/bin"
```

Don't forget to add this line in your `.bashrc` file if you want to keep this change after reboot.

Setup
-----

[](#setup)

By default, Poedit does not have the ability to parse Twig templates. This can be resolved by adding an additional parser (Edit &gt; Preferences &gt; Parsers) with the following options:

- Language: `Twig`
- List of extensions: `*.twig`
- Invocation:
    - Parser command: `/vendor/bin/twig-gettext-extractor --sort-output --force-po -o %o %C %K -L PHP --files %F` (replace `` with absolute path to your project)
    - An item in keyword list: `-k%k`
    - An item in input file list: `%f`
    - Source code charset: `--from-code=%c`

[![](https://camo.githubusercontent.com/60219b9af4599255341ef6c470d9b2a920c6fdfe0d129b8617ad434f7ef9e9aa/687474703a2f2f692e696d6775722e636f6d2f66397078322e706e67)](https://camo.githubusercontent.com/60219b9af4599255341ef6c470d9b2a920c6fdfe0d129b8617ad434f7ef9e9aa/687474703a2f2f692e696d6775722e636f6d2f66397078322e706e67)

Now you can update your catalog and Poedit will synchronize it with your twig templates.

Custom extensions
-----------------

[](#custom-extensions)

Twig-Gettext-Extractor registers some default twig extensions. However, if you are using custom extensions, you need to register them first before you can extract the data. In order to achieve that, copy the binfile into some custom place. A common practice would be: `cp vendor/bin/twig-gettext-extractor bin/twig-gettext-extractor`

Now you may add your custom extensions [here](https://github.com/umpirsky/Twig-Gettext-Extractor/blob/master/twig-gettext-extractor#L41):

```
$twig->addFunction(new \Twig_SimpleFunction('myCustomExtension', true));
$twig->addFunction(new \Twig_SimpleFunction('myCustomExtension2', true));
```

Command Line Arguments
----------------------

[](#command-line-arguments)

You can also specify custom extensions and filters via command line, by adding the --functions and --filters arguments, e.g.:

```
--functions formRow,formElement --filters localizedCurrency

```

You can specify an unlimited amount of comma-separated function and filter names.

Similarly, you can specify the location of the gettext executable you want to use with --exec

```
--exec /usr/local/bin/xgettext

```

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity50

Moderate usage in the ecosystem

Community25

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 83.1% 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 ~215 days

Recently: every ~310 days

Total

11

Last Release

2859d ago

PHP version history (3 changes)1.0.0PHP &gt;=5.3.3

v1.2.1PHP &gt;=5.5.9

v1.3.1PHP ^7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/379f6555cc98722ab303535ce5811af267fd006fc3e141bd0cea546430160c74?d=identicon)[umpirsky](/maintainers/umpirsky)

---

Top Contributors

[![umpirsky](https://avatars.githubusercontent.com/u/208957?v=4)](https://github.com/umpirsky "umpirsky (59 commits)")[![bjornpost](https://avatars.githubusercontent.com/u/48628?v=4)](https://github.com/bjornpost "bjornpost (4 commits)")[![Saeven](https://avatars.githubusercontent.com/u/887224?v=4)](https://github.com/Saeven "Saeven (2 commits)")[![Aluok](https://avatars.githubusercontent.com/u/4466212?v=4)](https://github.com/Aluok "Aluok (1 commits)")[![jasny](https://avatars.githubusercontent.com/u/100821?v=4)](https://github.com/jasny "jasny (1 commits)")[![sobolevn](https://avatars.githubusercontent.com/u/4660275?v=4)](https://github.com/sobolevn "sobolevn (1 commits)")[![eisberg](https://avatars.githubusercontent.com/u/9015003?v=4)](https://github.com/eisberg "eisberg (1 commits)")[![cheplv](https://avatars.githubusercontent.com/u/4574587?v=4)](https://github.com/cheplv "cheplv (1 commits)")[![daniel-iwaniec](https://avatars.githubusercontent.com/u/750044?v=4)](https://github.com/daniel-iwaniec "daniel-iwaniec (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/umpirsky-twig-gettext-extractor/health.svg)

```
[![Health](https://phpackages.com/badges/umpirsky-twig-gettext-extractor/health.svg)](https://phpackages.com/packages/umpirsky-twig-gettext-extractor)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k16.7M310](/packages/easycorp-easyadmin-bundle)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)

PHPackages © 2026

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