PHPackages                             parfumix/laravel-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. parfumix/laravel-translator

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

parfumix/laravel-translator
===========================

Translator for Laravel

v1.0(10y ago)014[1 issues](https://github.com/parfumix/laravel-translator/issues)1MITPHPPHP &gt;=5.4.0

Since Aug 25Pushed 10y ago1 watchersCompare

[ Source](https://github.com/parfumix/laravel-translator)[ Packagist](https://packagist.org/packages/parfumix/laravel-translator)[ Docs](https://github.com/parfumix/laravel-translator)[ RSS](/packages/parfumix-laravel-translator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (2)Used By (1)

\##Introduction

Laravel translator allow you to easy translate your website using different drivers like **File**, **Database** and others.

### Instalation

[](#instalation)

You can use the `composer` package manager to install. From console run:

```
  $ php composer.phar require parfumix/laravel-translator "v1.0"

```

or add to your composer.json file

```
"parfumix/laravel-translator": "v1.0"

```

You have to publish package files using

```
  $ php artisan vendor:publish

```

### Configuration

[](#configuration)

To register package you have to follow standart procedure registering serviceProvider class .Open your configuration file located in **config/app.php** and search for array of providers:

```
  'providers' => [
        // Add that line at the end of array ..
        'Translator\TranslatorServiceProvider'
      ]
```

\##Basic usage

Before using translator you have to publish your configuration file and select driver which you want to use

```
  $ php artisan vendor:publish

```

```
# here will be set up default driver .
default_driver: file
```

After all that you just have to use :

```
 __($key, $replacement, $locale = null) // will translate your key based on default selected driver. Locale will grab automaticly from localization component.
```

\###Extending You can register own translator drivers which have will have custom business logic . But for the first register it in your configuration file

```
drivers:
  my_driver:
    class: Namespace\To\My\Driver
    option1: value1
    option2: value2
  database:
    class: Translator\Drivers\Database
    cache_time: 60
  file:
    class: Translator\Drivers\File
```

and create you class which implelement **Translatable** interface:

```
