PHPackages                             scoobydam/php-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. scoobydam/php-translator

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

scoobydam/php-translator
========================

Simple and easy to use PHP translator using key =&gt; value system

1.0.0(5y ago)2193MITPHP

Since May 12Pushed 5y ago1 watchersCompare

[ Source](https://github.com/DamienVauchel/php-translator)[ Packagist](https://packagist.org/packages/scoobydam/php-translator)[ RSS](/packages/scoobydam-php-translator/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (3)Versions (2)Used By (0)

Simple and light PHP translator
===============================

[](#simple-and-light-php-translator)

[![Codacy Badge](https://camo.githubusercontent.com/eb3e5bec9bffa28dc7b698563f8a40928bdc72af0f463b947a91058ad13c153b/68747470733a2f2f6170702e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f6264636466376536363337613462353838616332336631633761653631383138)](https://www.codacy.com/gh/DamienVauchel/php-translator/dashboard?utm_source=github.com&utm_medium=referral&utm_content=DamienVauchel/php-translator&utm_campaign=Badge_Grade)

This library permits you to easily create translations for PHP scripts and apps.

Prerequisites
-------------

[](#prerequisites)

- PHP &gt;= 7.3

Install
-------

[](#install)

You can install the package with `git clone` and `composer install` in the directory.

Or you can directly use composer :

```
composer require scoobydam/php-translator
```

Use
---

[](#use)

This library is an easy-to-use and light one.

```
use ScoobyTranslator\Translator\Translator;

$translator = new Translator(__DIR__ . '/translations', 'fr');
$translator->translate('key_to_translate');
```

This example will search for a `fr.php` file in the dir you passed the path in the first parameter.
This file might be like following

```
