Download the PHP package flobbos/laravel-translatable-db without Composer

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

Laravel Translatable DB

Database-backed translated Eloquent attributes, resolved by a language id instead of a locale string.

This package started as a fork of dimsav/laravel-translatable. It only reads translated attributes. It does not manage CRUD forms or translation persistence.

Compatibility

Laravel Package
13.x 2.x
12.x 2.x
11.x 2.x
10.x 2.x
5.3-9.x 1.x

Laravel 10 support means the package requires PHP ^8.1. Laravel itself may require a higher PHP version for newer framework releases.

Installation

Laravel auto-discovery registers the service provider. Publish the config only when you need to override defaults:

Tables

Example for a translated Country model:

If your default language lives on the main model table, add the translated column there and enable native fallback on the model:

Then set:

Models

By convention, Country uses CountryTranslation. Override it when needed:

Usage

Configuration

Important defaults:

With database mode enabled, the middleware resolves app()->getLocale() through your language model and stores the matching id on the request.

With database mode disabled, configure languages directly:

Middleware

The middleware is no longer pushed globally by default in 2.x.

Register it where translated route content needs automatic language id resolution:

If you really want the old global behavior:

Polymorphic Translations

Implement PolyTrans and set the morph name:

Testing


All versions of laravel-translatable-db with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/contracts Version ^10.0|^11.0|^12.0|^13.0
illuminate/database Version ^10.0|^11.0|^12.0|^13.0
illuminate/http Version ^10.0|^11.0|^12.0|^13.0
illuminate/support Version ^10.0|^11.0|^12.0|^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 flobbos/laravel-translatable-db contains the following files

Loading the files please wait ...