PHPackages                             sboden/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. sboden/extractor

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

sboden/extractor
================

Extract translations form the source code

2.1.2(2y ago)013MITPHPPHP ^7.2 || ^8.0

Since Apr 26Pushed 2y agoCompare

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

READMEChangelog (2)Dependencies (9)Versions (3)Used By (0)

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

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 52.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 ~4 days

Total

2

Last Release

748d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2665ee6cad3ef62c3f9898251f942ac0c56903da18778ea70bb53e3a083c34ee?d=identicon)[sboden](/maintainers/sboden)

---

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 (4 commits)")[![lukepass](https://avatars.githubusercontent.com/u/6429961?v=4)](https://github.com/lukepass "lukepass (4 commits)")[![ostrolucky](https://avatars.githubusercontent.com/u/496233?v=4)](https://github.com/ostrolucky "ostrolucky (3 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)")[![Stadly](https://avatars.githubusercontent.com/u/7263579?v=4)](https://github.com/Stadly "Stadly (2 commits)")[![sboden](https://avatars.githubusercontent.com/u/15326242?v=4)](https://github.com/sboden "sboden (2 commits)")[![cristoforocervino](https://avatars.githubusercontent.com/u/25152680?v=4)](https://github.com/cristoforocervino "cristoforocervino (2 commits)")[![tkleinhakisa](https://avatars.githubusercontent.com/u/1912952?v=4)](https://github.com/tkleinhakisa "tkleinhakisa (2 commits)")[![welcoMattic](https://avatars.githubusercontent.com/u/773875?v=4)](https://github.com/welcoMattic "welcoMattic (1 commits)")[![cjean-wishibam](https://avatars.githubusercontent.com/u/31618269?v=4)](https://github.com/cjean-wishibam "cjean-wishibam (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)")[![marcw](https://avatars.githubusercontent.com/u/160332?v=4)](https://github.com/marcw "marcw (1 commits)")[![rbaarsma](https://avatars.githubusercontent.com/u/1061560?v=4)](https://github.com/rbaarsma "rbaarsma (1 commits)")[![rmbl](https://avatars.githubusercontent.com/u/60907?v=4)](https://github.com/rmbl "rmbl (1 commits)")[![samvdb](https://avatars.githubusercontent.com/u/632452?v=4)](https://github.com/samvdb "samvdb (1 commits)")

### Embed Badge

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

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

###  Alternatives

[php-translation/extractor

Extract translations form the source code

1294.4M8](/packages/php-translation-extractor)[barryvdh/laravel-translation-manager

Manage Laravel Translations

1.7k3.6M17](/packages/barryvdh-laravel-translation-manager)[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)[jms/translation-bundle

Puts the Symfony Translation Component on steroids

42510.8M63](/packages/jms-translation-bundle)[php-translation/symfony-bundle

3244.1M9](/packages/php-translation-symfony-bundle)[contao/core-bundle

Contao Open Source CMS

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

PHPackages © 2026

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