PHPackages                             erik-nystrom/php-i18n-extr - 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. erik-nystrom/php-i18n-extr

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

erik-nystrom/php-i18n-extr
==========================

Extract translation tokens from PHP/HTML/JS files

01PHPCI failing

Since Apr 22Pushed 6y ago1 watchersCompare

[ Source](https://github.com/erik-nystrom/php-i18n-extr)[ Packagist](https://packagist.org/packages/erik-nystrom/php-i18n-extr)[ RSS](/packages/erik-nystrom-php-i18n-extr/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

PHP i18n Extraction Utility
===========================

[](#php-i18n-extraction-utility)

Extract translation tokens from .php, .html, and .js files, and export in .pot file format. Also supports other extensions, so long as they can be parsed as PHP or JavaScript.

Why did I make this?
--------------------

[](#why-did-i-make-this)

I wanted to roll my own translation system while still keeping things similar to PHP's gettext implementation.

This utility will also extract from .js files, as well as JS embedded in HTML files, which is an added bonus.

Usage
-----

[](#usage)

Install via Composer:

```
composer require erik-nystrom/php-i18n-extr

```

Alias/Import into your script, create an instance of the Extractor, add some files, and tokenize:

```
use I18nExtractor\Extractor as Extractor;

$ex = new Extractor();

$ex->add("/path/to/your/website");
$ex->add("/path/to/another/script.php");
$ex->add("/path/to/another/script.js");

$ex->tokenize();

file_put_contents('default.pot', $ex->stringsAsPOT());

```

By default the Extractor class will look for `_()`, but you can change this if you'd like.

It will also search for .php, .html (parsed as .php), and .js files by default. You can add any other extensions you'd like, as long as they can be successfully parsed as PHP or JavaScript.

The resulting file should load fine in something like [poedit](https://poedit.net/).

License
-------

[](#license)

[MIT](https://choosealicense.com/licenses/mit/)

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/63740247?v=4)[Erik Nystrom](/maintainers/erik-nystrom)[@erik-nystrom](https://github.com/erik-nystrom)

---

Top Contributors

[![erik-nystrom](https://avatars.githubusercontent.com/u/63740247?v=4)](https://github.com/erik-nystrom "erik-nystrom (15 commits)")

### Embed Badge

![Health badge](/badges/erik-nystrom-php-i18n-extr/health.svg)

```
[![Health](https://phpackages.com/badges/erik-nystrom-php-i18n-extr/health.svg)](https://phpackages.com/packages/erik-nystrom-php-i18n-extr)
```

###  Alternatives

[symfony/translation

Provides tools to internationalize your application

6.6k836.5M2.1k](/packages/symfony-translation)[nesbot/carbon

An API extension for DateTime that supports 281 different languages.

169661.4M4.8k](/packages/nesbot-carbon)[joedixon/laravel-translation

A tool for managing all of your Laravel translations

717911.4k11](/packages/joedixon-laravel-translation)[illuminate/translation

The Illuminate Translation package.

6936.4M495](/packages/illuminate-translation)[lajax/yii2-translate-manager

Translation management extension for Yii 2

227578.8k13](/packages/lajax-yii2-translate-manager)[larswiegers/laravel-translations-checker

Make sure your laravel translations are checked and are included in all languages.

256423.2k2](/packages/larswiegers-laravel-translations-checker)

PHPackages © 2026

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