PHPackages                             php-translation/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. [Localization &amp; i18n](/categories/localization)
4. /
5. php-translation/extractor

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

php-translation/extractor
=========================

Extract translations form the source code

2.3.2(3w ago)1294.5M↓44.9%36[15 issues](https://github.com/php-translation/extractor/issues)[1 PRs](https://github.com/php-translation/extractor/pulls)8MITPHPPHP ^8.1CI failing

Since Dec 5Pushed 3w ago8 watchersCompare

[ Source](https://github.com/php-translation/extractor)[ Packagist](https://packagist.org/packages/php-translation/extractor)[ RSS](/packages/php-translation-extractor/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (10)Dependencies (29)Versions (31)Used By (8)

Translation extractor
=====================

[](#translation-extractor)

[![Latest Version](https://camo.githubusercontent.com/4b1c569a6deaf36e01329df1d74e4e8c6da0d65cfb8acd39129d5cd650ffbc14/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f7068702d7472616e736c6174696f6e2f657874726163746f722e7376673f7374796c653d666c61742d737175617265)](https://github.com/php-translation/extractor/releases)[![Total Downloads](https://camo.githubusercontent.com/191cbc5b4a5ccbdb4b2a14702a21b88d33f1a5380381eea713ee21dcb572864d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7068702d7472616e736c6174696f6e2f657874726163746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/php-translation/extractor)

**Extract translation messages from source code**

Install
-------

[](#install)

Via Composer:

```
$ composer require php-translation/extractor
```

Usage
-----

[](#usage)

```
$extractor = new Extractor();

// Create an extractor for PHP files
$fileExtractor = new PHPFileExtractor();

// Add visitors
$fileExtractor->addVisitor(new ContainerAwareTrans());
$fileExtractor->addVisitor(new ContainerAwareTransChoice());
$fileExtractor->addVisitor(new FlashMessage());
$fileExtractor->addVisitor(new FormTypeChoices());

// Add the file extractor to Extactor
$extractor->addFileExtractor($fileExtractor);

// Define where the source code is
$finder = new Finder();
$finder->in('/foo/bar');

//Start extracting files
$sourceCollection = $extractor->extract($finder);
```

Found an issue?
---------------

[](#found-an-issue)

Is it something we do not extract? Please add it as a test. Add a new file with your example code in `tests/Resources/Github/Issue_XX.php`, then edit the `AllExtractorsTest` to make sure the translation key is found:

```
// ...
$this->translationExists($sc, 'trans.issue_xx');
```

###  Health Score

71

—

ExcellentBetter than 100% of packages

Maintenance92

Actively maintained with recent releases

Popularity60

Solid adoption and visibility

Community36

Small or concentrated contributor base

Maturity83

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 50.3% 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 ~118 days

Recently: every ~38 days

Total

30

Last Release

27d ago

Major Versions

0.1.1 → 1.0.02017-01-04

1.7.1 → 2.0.02019-12-26

PHP version history (4 changes)0.1.0PHP ^5.5 || ^7.0

2.0.0PHP ^7.2

2.0.3PHP ^7.2 || ^8.0

2.2.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/401ccc5eea13c60cf807ae982af00e368e2166e2f26d8eb541dcd881a57385bc?d=identicon)[Nyholm](/maintainers/Nyholm)

---

Top Contributors

[![Nyholm](https://avatars.githubusercontent.com/u/1275206?v=4)](https://github.com/Nyholm "Nyholm (91 commits)")[![bocharsky-bw](https://avatars.githubusercontent.com/u/3317635?v=4)](https://github.com/bocharsky-bw "bocharsky-bw (39 commits)")[![Guite](https://avatars.githubusercontent.com/u/277531?v=4)](https://github.com/Guite "Guite (9 commits)")[![gimler](https://avatars.githubusercontent.com/u/200904?v=4)](https://github.com/gimler "gimler (6 commits)")[![lukepass](https://avatars.githubusercontent.com/u/6429961?v=4)](https://github.com/lukepass "lukepass (4 commits)")[![PowerKiKi](https://avatars.githubusercontent.com/u/72603?v=4)](https://github.com/PowerKiKi "PowerKiKi (3 commits)")[![noofaq](https://avatars.githubusercontent.com/u/1412384?v=4)](https://github.com/noofaq "noofaq (3 commits)")[![ostrolucky](https://avatars.githubusercontent.com/u/496233?v=4)](https://github.com/ostrolucky "ostrolucky (3 commits)")[![tkleinhakisa](https://avatars.githubusercontent.com/u/1912952?v=4)](https://github.com/tkleinhakisa "tkleinhakisa (2 commits)")[![mgiraud](https://avatars.githubusercontent.com/u/11818237?v=4)](https://github.com/mgiraud "mgiraud (2 commits)")[![nexxome](https://avatars.githubusercontent.com/u/2526962?v=4)](https://github.com/nexxome "nexxome (2 commits)")[![cristoforocervino](https://avatars.githubusercontent.com/u/25152680?v=4)](https://github.com/cristoforocervino "cristoforocervino (2 commits)")[![Stadly](https://avatars.githubusercontent.com/u/7263579?v=4)](https://github.com/Stadly "Stadly (2 commits)")[![welcoMattic](https://avatars.githubusercontent.com/u/773875?v=4)](https://github.com/welcoMattic "welcoMattic (1 commits)")[![axi](https://avatars.githubusercontent.com/u/389340?v=4)](https://github.com/axi "axi (1 commits)")[![cjean-wishibam](https://avatars.githubusercontent.com/u/31618269?v=4)](https://github.com/cjean-wishibam "cjean-wishibam (1 commits)")[![gchehami](https://avatars.githubusercontent.com/u/3714037?v=4)](https://github.com/gchehami "gchehami (1 commits)")[![GCth](https://avatars.githubusercontent.com/u/2381835?v=4)](https://github.com/GCth "GCth (1 commits)")[![jdreesen](https://avatars.githubusercontent.com/u/424602?v=4)](https://github.com/jdreesen "jdreesen (1 commits)")[![lepiaf](https://avatars.githubusercontent.com/u/1940947?v=4)](https://github.com/lepiaf "lepiaf (1 commits)")

### Embed Badge

![Health badge](/badges/php-translation-extractor/health.svg)

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

###  Alternatives

[zircote/swagger-php

Generate interactive documentation for your RESTful API using PHP attributes (preferred) or PHPDoc annotations

5.3k140.4M553](/packages/zircote-swagger-php)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.5M370](/packages/easycorp-easyadmin-bundle)[symfony/framework-bundle

Provides a tight integration between Symfony components and the Symfony full-stack framework

3.6k246.0M11.0k](/packages/symfony-framework-bundle)[jolicode/castor

A lightweight and modern task runner. Automate everything. In PHP.

54642.4k4](/packages/jolicode-castor)[phparkitect/phparkitect

Enforce architectural constraints in your PHP applications

9134.1M24](/packages/phparkitect-phparkitect)[sulu/sulu

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

1.3k1.4M195](/packages/sulu-sulu)

PHPackages © 2026

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