PHPackages                             inweb/translations-parser - 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. inweb/translations-parser

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

inweb/translations-parser
=========================

Parse files and pull translatable phrases

8.0.2(4y ago)03291MITPHPPHP ^7.1|^8.0

Since Dec 10Pushed 4y ago1 watchersCompare

[ Source](https://github.com/inwebcomp/translations-parser)[ Packagist](https://packagist.org/packages/inweb/translations-parser)[ Docs](https://github.com/inwebcomp/translations-parser)[ RSS](/packages/inweb-translations-parser/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (4)Used By (1)

Parse your files and pull translatable phrases.

Requirements
------------

[](#requirements)

- PHP &gt;= 7.1

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

[](#installation)

You can install the package via composer:

```
composer require inwebcomp/translations-parser
```

Give access to you ./lang folder

```
chmod 0777 -R ./resources/lang
```

Add facade to your *config/app.php* file

```
'aliases' => [
    // ...
    'TranslationsParser' => InWeb\TranslationsParser\TranslationsParserFacade::class
],
```

### Configuration

[](#configuration)

Run to publish **translations-parser.php** configuration file

```
php artisan vendor:publish --provider="InWeb\TranslationsParser\TranslationsParserServiceProvider"
```

There you can change locales and folders that are used by artisan command

```
// Locales to save phrases
'locales' => [
    'ru',
    'en'
],

// Directories in which phrases are searched
'directories' => [
    base_path('app'),
    resource_path('views'),
    resource_path('js')
],

// Excluded directories or files
'excluded' => [
    base_path('app/Nova')
],

// Where is your folder with translations
'lang_files_directory' => resource_path('lang')
```

Sometimes you receive your locales list during the application run. You can just overwrite this setting in your code:

```
\Config::set('translations-parser.locales', [
    'en',
    'fr
]);
```

Usage
-----

[](#usage)

### Artisan commands

[](#artisan-commands)

Parse translations with artisan command

```
php artisan translations:parse
```

Force parse translations. **Old translations will be removed**

```
php artisan translations:parse --force
```

### Methods

[](#methods)

Get phrases from string

```
TranslationsParser::parse('@lang("Phrase")');
// ['Phrase']
```

Get phrases from files in directories

```
TranslationsParser::parse([
    resouce_path('views'),
    resouce_path('js')
]);
// ['Phrase 1', 'Phrase 2', ...]
```

Can exclude directories or files from list

```
TranslationsParser::parse([
    resouce_path('views')
], [
    resouce_path('views/layouts') // Exclude 'views/layouts' directory
]);
```

Get phrases in *{locale}.json* file

```
TranslationsParser::getParsed('en');
```

Save phrases to .json file

```
TranslationsParser::save('en', [
    'Phrase'
]);

// Or with values
TranslationsParser::save('en', [
    'Phrase' => 'Value'
]);
```

By default, phrases would **not be overwritten**It will be overwritten only if there is no phrase in your .json file, or phrase translation is empty

Set last parameter to true to force writing in .json. **You will lose old data**

```
TranslationsParser::save('en', [
    'Phrase' => 'Value'
], true);
```

Save one phrase translation

```
TranslationsParser::translate('en', 'Phrase', 'Translation');
```

### Testing

[](#testing)

```
composer test
```

Credits
-------

[](#credits)

- [Alexander Topalo](https://github.com/Escral)

License
-------

[](#license)

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

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~1 days

Total

3

Last Release

1663d ago

PHP version history (2 changes)8.0.0PHP &gt;=7.0|8.0

8.0.2PHP ^7.1|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/19815216?v=4)[Alexander Topalo](/maintainers/Escral)[@escral](https://github.com/escral)

---

Top Contributors

[![escral](https://avatars.githubusercontent.com/u/19815216?v=4)](https://github.com/escral "escral (7 commits)")

---

Tags

inwebcomptranslations-parser

### Embed Badge

![Health badge](/badges/inweb-translations-parser/health.svg)

```
[![Health](https://phpackages.com/badges/inweb-translations-parser/health.svg)](https://phpackages.com/packages/inweb-translations-parser)
```

###  Alternatives

[smmoosavi/php-gettext

Wrapper for php-gettext by danilo segan. This library provides PHP functions to read MO files even when gettext is not compiled in or when appropriate locale is not present on the system.

1927.0k1](/packages/smmoosavi-php-gettext)[saeven/circlical-po-editor

Gettext \*.PO file editor and parser for PHP.

118.1k1](/packages/saeven-circlical-po-editor)

PHPackages © 2026

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