Download the PHP package jvdlaar/laravel-content-translation without Composer

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

Latest Version Total Downloads

Laravel content translation

This package makes properties of your models translatable. For example when you have a Country model then you can make the country name translatable.

Todo

Installation

This package can be installed through Composer.

You must install this service provider.

This package also comes with a facade, which provides an easy way to call the the class.

You can publish the config file of this package with this command:

The following config file will be published in config/content-translation.php

The array key is they key with which the translations are stored in the database, "class" refers to the model class. "label_property" is used to determine the translatable label of this model. E.g. the country name in the country model. "properties" is an array with the translatable properties and whether they are required and their output needs to be nl2br.

Usage

After installation and configuration you need to make models translatable by implementing the TranslatableContract. The HasTranslatables trait helps with this.

Example model

In above example $country->name and $country->nationality are translated. When there is no translation in the database the admin_name property is used as fallback. The 2nd parameter of the function displayTranslation says that there is a default that should be used. The 3rd parameter is the locale of the translation, by default the current app locale will be used. 4th parameter determines that a fallback language should be used, this fallback language is set in the config.

Eager load translations for multiple models.

In above example 3 countries are eager loaded. So loading the model later and requesting a translation doesn't need an additional query.

Saving translations

You can add a translation to the database by using the facade:

Or by using a method on the model:

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

About ezCompany

ezCompany is a webdevelopment agency in the Netherlands located in Tilburg, Breda and Utrecht. For more information see our website.

License

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


All versions of laravel-content-translation with dependencies

PHP Build Version
Package Version
Requires php Version ^7.0
illuminate/database Version ~5.2.0|~5.3.0|~5.4.0
illuminate/support Version ~5.2.0|~5.3.0|~5.4.0
mcamara/laravel-localization Version ^1.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 jvdlaar/laravel-content-translation contains the following files

Loading the files please wait ....