Download the PHP package koenhoeijmakers/laravel-translatable without Composer

On this page you can find all versions of the php package koenhoeijmakers/laravel-translatable. 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-translatable

Laravel Translatable

Packagist Build Status Code Coverage Scrutinizer Code Quality license Packagist

A fresh new way to handle Model translations, the translations are joined into the Model instead of making you query a relation or get every single attribute's translation one by one.

Installation

Require the package.

... and optionally publish the config.

Usage

Setting up a translatable Model.

Start off by creating a migration and a Model, we'll go with the Animal Model and the corresponding AnimalTranslation Model.

Migrations

Always have a locale and a foreign_key to the original Model, in our case animal_id.

Models

Register the trait on the Model, and add the columns that should be translated to the $translatable property, But also make them fillable, this is because the saving is handled through events, this way we don't have to change the save method and makes the package more interoperable.

So make sure the $translatable columns are also $fillable on both Models.

This is pretty much all there is to it, but you can read more about the package down here.

About

What makes this package so special is the way it handles the translations, how it retrieves them, how it stores them, and how it queries them.

Querying

Due to how the package handles the translations, querying is a piece of cake, while for other packages you would have a ->whereTranslation('nl', 'column', '=', 'foo') method.

But in this package you can just do ->where('column', '=', 'foo') and it'll know what to query, just query how you used to!

Retrieving

When you retrieve a Model from the database, the package will join the translation table with the translation of the current locale config/app.php.

This makes it so that any translated column acts like it is "native" to the Model, due to this we don't have to override a lot of methods on the Model which is a big plus.

Need the Model in a different language? Call $model->translate('nl') and you are done. Now you would like to save the nl translation? just call ->update(). The Model knows in which locale it is loaded and it will handle it accordingly.

Storing

You will be storing your translations as if they're attributes on the Model, so this will work like a charm:

But i hear you, you would like to store multiple translations in one request! In that so you can use the ->storeTranslation() or the ->storeTranslations() method.


All versions of laravel-translatable with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2.5
laravel/framework Version ^7.4
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 koenhoeijmakers/laravel-translatable contains the following files

Loading the files please wait ....