PHPackages                             grizz-it/translator - 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. grizz-it/translator

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

grizz-it/translator
===================

A package containing tools to translate strings and arrays.

1.2.0(5y ago)19033MITPHPPHP ^8.0CI failing

Since Mar 9Pushed 5y ago1 watchersCompare

[ Source](https://github.com/grizz-it/translator)[ Packagist](https://packagist.org/packages/grizz-it/translator)[ RSS](/packages/grizz-it-translator/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (4)Dependencies (2)Versions (5)Used By (3)

[![Build Status](https://camo.githubusercontent.com/8dc80f5cd262523777111bdc2c86657d88f0d5c1a128ac54174dad0caefdc950/68747470733a2f2f7472617669732d63692e636f6d2f6772697a7a2d69742f7472616e736c61746f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/grizz-it/translator)

GrizzIT Translator
==================

[](#grizzit-translator)

This package contains an implementation to simplify translations between strings and arrays.

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

[](#installation)

To install the package run the following command:

```
composer require grizz-it/translator

```

Usage
-----

[](#usage)

The package contains two implementations for translations.

### [Translator](src/Component/Translator.php)

[](#translator)

The Translator is a simple string to string translator. It takes a left argument to translate to a right and vice-versa. These translations are possible by invoking the correct method, either `getLeft` or `getRight`. When invoking `getLeft` it will translate from the left arguments to the right.

Translations can be registered with the `register` method.

Default values can be provided to the constructor. If these are null, an exception will be thrown when an untranslatable string is detected.

### [ArrayTranslator](src/Component/ArrayTranslator.php)

[](#arraytranslator)

The ArrayTranslator works similar to the string translator. However the array translator can translate from and to multiple outcomes.

The array translator will still retrieve one value (the first match) when calling either `getLeft` or `getRight`. However when invoking `getAllLeft` or `getAllRight`, all outcomes of the opposite side will be returned.

Registration is the only other key difference, every translation left and right needs to be registered as an array. Even if either one only has one option.

### [MatchingTranslator](src/Component/MatchingTranslator.php) &amp; [MatchingArrayTranslator](src/Component/MatchingArrayTranslator.php)

[](#matchingtranslator--matchingarraytranslator)

The MatchingTranslator and MatchingArrayTranslator are similar to the aforementioned translators. However these translator are slower, because they check each individual key during a comparison supporting the Unix filename pattern.

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

MIT License
-----------

[](#mit-license)

Copyright (c) GrizzIT

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity65

Established project with proven stability

 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 ~117 days

Total

4

Last Release

1947d ago

PHP version history (2 changes)1.0.0PHP ^7.2

1.2.0PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8682881?v=4)[GrizzIT](/maintainers/GrizzIT)[@grizzit](https://github.com/grizzit)

---

Top Contributors

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

---

Tags

phptranslationtranslations

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/grizz-it-translator/health.svg)

```
[![Health](https://phpackages.com/badges/grizz-it-translator/health.svg)](https://phpackages.com/packages/grizz-it-translator)
```

###  Alternatives

[barryvdh/laravel-translation-manager

Manage Laravel Translations

1.7k3.7M18](/packages/barryvdh-laravel-translation-manager)[gettext/languages

gettext languages with plural rules

7532.0M12](/packages/gettext-languages)[kkomelin/laravel-translatable-string-exporter

Translatable String Exporter for Laravel

3291.5M17](/packages/kkomelin-laravel-translatable-string-exporter)[punic/punic

PHP-Unicode CLDR

1543.0M30](/packages/punic-punic)[outhebox/laravel-translations

Manage your Laravel translations with a beautiful UI. Add, edit, delete, import, and export translations with ease.

81396.3k](/packages/outhebox-laravel-translations)[outl1ne/nova-translations-loader

This Laravel Nova package helps developers load translations into their packages.

395.7M46](/packages/outl1ne-nova-translations-loader)

PHPackages © 2026

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