Download the PHP package rpwebdevelopment/laravel-ugc-translate without Composer

On this page you can find all versions of the php package rpwebdevelopment/laravel-ugc-translate. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-ugc-translate

User generated content translation package

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This is a Laravel specific package designed to automate the translation of user generated content in a database driven fashion.

Installation

You can install the package via composer:

Configuration

This package implements the DeepL API for machine translation, as such you will need to provide an appropriate API key in your .env file:

If you do not wish every record update/creation to trigger automatic translation, you can disable the observer by adding the following to your .env file:

Sometimes you may only want translations enabled on a model if certain conditions are met, for example if a flag is set against the model instance, in order to achieve this you can add the method getHasTranslationsAttribute to the model returning a boolean value, i.e.

You can update the config file ugc-translate.php in order to set any languages needed for translation:

Usage

The package provides a new trait that can be used in order to apply automatic translations:

In order to define translatable fields, and languages required for translation our models will now require a new property $ugcTranslatable defining the DB fields to be translated:

Unless you have disabled auto-translate, creating or updating a record within your model will cause translations to be generated and stored. The package leverages Laravel's locale in order to assert which language is to be returned. If we take our posts model above with the following record:

You can achieve the following:

Sometimes you may wish to output a specific language value without switching the application locale, this can be achieved using the following method:

Sometimes you may not need all the default languages for every model, in order to override the default languages on a model you can simply add the getUgcLanguagesAttribute method to the model returning an array of locale codes:

If you use Livewire in your application there is a custom modal available for editing & locking specific translations, you can publish the modal component and view by runningg the following command:

Once published you can add the modal into your project with the following tag:

This will add a button to your blade template that will open the following modal:

Locking translations will prevent them from being automatically updated.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-ugc-translate with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
deeplcom/deepl-php Version ^1.1
spatie/laravel-package-tools Version ^1.13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package rpwebdevelopment/laravel-ugc-translate contains the following files

Loading the files please wait ....