PHPackages                             gettext/php-scanner - 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. gettext/php-scanner

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

gettext/php-scanner
===================

PHP scanner for gettext

v2.0.1(1y ago)15471.2k—3%6[2 issues](https://github.com/php-gettext/PHP-Scanner/issues)11MITPHPPHP &gt;=7.4

Since Nov 4Pushed 1y ago2 watchersCompare

[ Source](https://github.com/php-gettext/PHP-Scanner)[ Packagist](https://packagist.org/packages/gettext/php-scanner)[ Docs](https://github.com/php-gettext/PHP-Scanner)[ RSS](/packages/gettext-php-scanner/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (12)Used By (11)

PHP Scanner
===========

[](#php-scanner)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c6a990ee197c99fbc29240c4a347b5eb334626dc0d57d4446f8f008e8c3ce85a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f676574746578742f7068702d7363616e6e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gettext/php-scanner)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Build Status](https://camo.githubusercontent.com/88aa9479b0e10cd1ffdd39a9351e935d9fa656d2402fa72f0deb787380258716/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7068702d676574746578742f5048502d5363616e6e65722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/php-gettext/PHP-Scanner)[![Total Downloads](https://camo.githubusercontent.com/6450a2c508397c188aa2a96886ab9f5f8655e155a9465a3a9fc48bcb7b9bac67/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f676574746578742f7068702d7363616e6e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gettext/php-scanner)

Created by Oscar Otero   (MIT License)

PHP code scanner to use with [gettext/gettext](https://github.com/php-gettext/Gettext)

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

[](#installation)

```
composer require gettext/php-scanner

```

Usage example
-------------

[](#usage-example)

```
use Gettext\Scanner\PhpScanner;
use Gettext\Generator\PoGenerator;
use Gettext\Translations;

//Create a new scanner, adding a translation for each domain we want to get:
$phpScanner = new PhpScanner(
    Translations::create('domain1'),
    Translations::create('domain2'),
    Translations::create('domain3')
);

//Set a default domain, so any translations with no domain specified, will be added to that domain
$phpScanner->setDefaultDomain('domain1');

//Extract all comments starting with 'i18n:' and 'Translators:'
$phpScanner->extractCommentsStartingWith('i18n:', 'Translators:');

//Scan files
foreach (glob('*.php') as $file) {
    $phpScanner->scanFile($file);
}

//Save the translations in .po files
$generator = new PoGenerator();

foreach ($phpScanner->getTranslations() as $domain => $translations) {
    $generator->generateFile($translations, "locales/{$domain}.po");
}
```

---

Please see [CHANGELOG](CHANGELOG.md) for more information about recent changes and [CONTRIBUTING](CONTRIBUTING.md) for contributing details.

The MIT License (MIT). Please see [LICENSE](LICENSE) for more information.

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity46

Moderate usage in the ecosystem

Community26

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 60% 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 ~185 days

Recently: every ~354 days

Total

11

Last Release

535d ago

Major Versions

v1.3.1 → v2.0.02024-03-10

PHP version history (3 changes)v1.0.0PHP ^7.2

v1.2.2PHP &gt;=7.2

v2.0.0PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/e99df56b617f4af8cf0556a51a0ca20c7420104920c57d7e9eab093f92bb744f?d=identicon)[oscarotero](/maintainers/oscarotero)

---

Top Contributors

[![oscarotero](https://avatars.githubusercontent.com/u/377873?v=4)](https://github.com/oscarotero "oscarotero (18 commits)")[![BusterNeece](https://avatars.githubusercontent.com/u/6744885?v=4)](https://github.com/BusterNeece "BusterNeece (4 commits)")[![doyouhaobaby](https://avatars.githubusercontent.com/u/2012511?v=4)](https://github.com/doyouhaobaby "doyouhaobaby (3 commits)")[![rodber](https://avatars.githubusercontent.com/u/20590102?v=4)](https://github.com/rodber "rodber (3 commits)")[![mjrider](https://avatars.githubusercontent.com/u/213105?v=4)](https://github.com/mjrider "mjrider (1 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")

---

Tags

code-scanninggettexti18ntranslationphpi18ntranslationgettextscanner

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/gettext-php-scanner/health.svg)

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

###  Alternatives

[om/potrans

Command line tool for translate Gettext with Google Translator API or DeepL API

10515.0k4](/packages/om-potrans)[leaseweb/gettext-translation-bundle

Easy to use and native (faster) gettext translation support

2460.6k](/packages/leaseweb-gettext-translation-bundle)[delight-im/i18n

Internationalization and localization for PHP

625.2k3](/packages/delight-im-i18n)[jayesh/laravel-gemini-translator

An interactive command to extract and generate Laravel translations using Gemini AI.

691.7k1](/packages/jayesh-laravel-gemini-translator)

PHPackages © 2026

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