gino-pane/laravel-phpolyglot

Laravel package wrapper for PHP package for translation, spelling correction and text-to-speech (TTS) synthesis using external APIs

1.0.6 2018-11-05 09:18 UTC

This package is auto-updated.

Last update: 2024-10-06 09:25:27 UTC


README

Latest Stable Version License Total Downloads

Laravel package wrapper for PHPolyglot.

Requirements

  • PHP >= 7.1;
  • Laravel Framework.

Installation

composer require gino-pane/laravel-phpolyglot

As per Laravel 5.5+ service provider and facade will be registered automatically when installing. For previous versions please register service provider and facade manually. Optionally, after package installation please make sure to publish its configuration (if it was not done automatically by composer command):

php artisan vendor:publish --provider="GinoPane\LaravelPhpolyglot\LaravelPhpolyglotProvider" --tag=config

or

composer run-script publish-config -d ./vendor/gino-pane/laravel-phpolyglot

Also make sure to manually put your specific credentials from PHPolyglot's .env file into Laravel's .env because automatic changes to .env are not welcome:

PUSHER_APP_KEY=...
PUSHER_APP_SECRET=...
PUSHER_APP_CLUSTER=...
...
YANDEX_TRANSLATE_API_KEY=...
...

After this you could do something like this in your Laravel's web.php:

Route::get('/', function () {
    echo (string)PHPolyglot::translate('welcome', 'it');
});

...to get nice "benvenuto" string in your browser when accessing your test project's root page.

Usage

Please refer to original PHPolyglot documentation.

Changelog

To keep track, please refer to CHANGELOG.md.

License

Please refer to LICENSE.