PHPackages                             marksitko/laravel-deep-translatable - 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. marksitko/laravel-deep-translatable

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

marksitko/laravel-deep-translatable
===================================

Translates automatic eloquent model attributes via DeepL

v1.0.0(4y ago)510MITPHPPHP ^8.0|^8.1

Since Apr 11Pushed 4y ago1 watchersCompare

[ Source](https://github.com/marksitko/laravel-deep-translatable)[ Packagist](https://packagist.org/packages/marksitko/laravel-deep-translatable)[ Docs](https://github.com/marksitko/laravel-deep-translatable)[ RSS](/packages/marksitko-laravel-deep-translatable/feed)WikiDiscussions main Synced yesterday

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

Automatic translatables Eloquent models with DeepL
==================================================

[](#automatic-translatables-eloquent-models-with-deepl)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ea40efc8014e1e30811fc7e28234925d38c0b9d2f083c76d5689c5ee8ac3e841/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d61726b7369746b6f2f6c61726176656c2d646565702d7472616e736c617461626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/marksitko/laravel-deep-translatable)[![Total Downloads](https://camo.githubusercontent.com/840bdb33f5d2e7af73bee09b06736440ce519b1c1f7b2a73efa933357e0a869b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d61726b7369746b6f2f6c61726176656c2d646565702d7472616e736c617461626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/marksitko/laravel-deep-translatable)

Laravel-Deep-Translatable is more than just an API Wrapper for DeepL. It contains a trait to make Eloquent models automatic translatable. So you can easily publish a Blog post (or whatever) and create multiple language versions of it quite automatically. If you need to adjust or refine the translation, just got for it by using the provided `updateTranslation` method.

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

[](#installation)

Install the package via composer:

```
composer require marksitko/laravel-deep-translatable
```

Laravel-Deep-Translatable comes with package discovery and Laravel will register the service provider automatically. Just in case you wanna add it manually, you should provide it in config/app.php

**Service provider**

```
'providers' => [
    //...
    MarkSitko\DeepTranslatable\DeepTranslatableServiceProvider::class,
];
```

Next you should publish the configuration and migration.

```
$ php artisan vendor:publish --provider="MarkSitko\DeepTranslatable\DeepTranslatableServiceProvider"
```

Run migrations

```
$ php artisan migrate
```

Configuration
-------------

[](#configuration)

You have at least to provide a DeepL API key in your `.env` file. [Read how to accessing the DeepL API](https://www.deepl.com/docs-api/accessing-the-api/)

```
DEEP_TRANSLATABLE_AUTH_KEY=YOUR_GENERATED_API_KEY_FROM_DEEP_L

```

Optional configurations:

```
# Swaps the api url if you have subscriped to the pro plan
DEEP_TRANSLATABLE_USE_PRO_VERSION=false

# The default source language
DEEP_TRANSLATABLE_SOURCE_LANG=en

# The query parameter which indicates to switch beteween translations
DEEP_TRANSLATABLE_QUERY_ATTRIBUTE=lang

# Translation can be passed to the queue, its recommended if you translation bulks
DEEP_TRANSLATABLE_USE_QUEUE=false

# Specific queue name
DEEP_TRANSLATABLE_QUEUE_NAME=null

```

Usage
-----

[](#usage)

First implement the `Translatable` Interface, add the `UseDeepTranslations` Trait and define your `translatable` keys.

```
