Download the PHP package pictastudio/translatable without Composer

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

Laravel Translatable

Single-table polymorphic translations for Laravel Eloquent models, with optional AI-powered translation workflows.

Features

Installation

Laravel auto-discovers the service provider.

The quickest setup path is:

translatable:install publishes:

Manual setup is also supported:

Configure at least one Laravel AI provider in config/ai.php or with environment variables such as OPENAI_API_KEY.

If you are upgrading from an older package version, publish migrations again before running php artisan migrate so new translation metadata columns are added.

Model Setup

Models must both use the trait and implement the package contract so they can be discovered by commands and API endpoints.

All translations live in a single translations table with:

generated_by is set to user for user-written translations and ai for AI-generated ones. User-written translations are automatically accepted; AI-generated translations are stored with accepted_at = null.

Writing Translations

Use locale suffixes:

Use locale-keyed arrays:

Use translation bags:

If you set translatable.translations_wrapper, the model also accepts nested payloads under that key.

Reading Translations

The current app locale is used by default:

You can work with translation bags directly:

Other helper methods:

setDefaultLocale() changes the locale used by that model instance without changing the application locale.

Fallbacks And Base Columns

Fallback behavior is driven by:

When enabled, attribute reads follow this order:

  1. Requested locale.
  2. Fallback locale, including language fallback for country-based locales such as en-US -> en.
  3. Base model column when the translated attribute also exists on the model table.

This means existing schemas such as products.name can keep working even before every translation is populated.

With sync_base_attributes=true, writing a translated value mirrors it into the matching base column when that column exists and the model is being created, or the base column is still empty. This is useful when legacy columns are non-nullable.

Serialization And Deletion

By default, toArray() includes translated attributes for the current locale. Disable that behavior with to_array_always_loads_translations=false if you want translation loading to stay fully explicit.

When delete_translations_on_delete=true, deleting a translatable model deletes its translations as well.

Locales Helper

The package registers PictaStudio\Translatable\Locales as both:

It exposes the configured locale list and locale utilities:

translatable.locales supports both flat and country-based configuration:

That configuration produces en, en-US, en-GB, and it.

Locale Header Middleware

PictaStudio\Translatable\Middleware\SetLocaleFromHeader can be prepended to the HTTP kernel automatically.

When enabled, it reads the configured header and only switches locale if the value exists in translatable.locales.

Relevant config:

AI Translation

The package integrates with the Laravel AI SDK through PictaStudio\Translatable\Ai\ModelTranslator.

Programmatic usage:

Behavior:

Artisan Commands

Translate one model class:

Command behavior:

Translate all currently missing translations across every discovered translatable model:

translatable:translate-missing only uses accepted source translations by default.

Queueing

API-triggered translations are queued through PictaStudio\Translatable\Ai\Jobs\TranslateModelsJob.

Queue config:

Completion Event

When queued translations finish, the package dispatches PictaStudio\Translatable\Events\AiTranslationsCompleted.

HTTP API

The package registers its API routes by default. Disable them with:

Default route config:

Endpoints:

GET /locales

Returns configured locales and marks the default locale. This endpoint does not use translation API authorization rules.

GET /models

Returns discoverable translatable models:

Morph aliases come from Laravel's morph map when available. Otherwise the fully qualified class name is returned.

GET /missing-translations

Supported query parameters:

model accepts either a fully qualified class name or a morph alias.

Rows are only returned when:

Response items contain:

accepted=true restricts the scan to accepted translation records. accepted=false restricts it to non-accepted translation records.

POST /translate

Example payload:

Notes:

API Authorization

Three authorization modes are supported for /models, /missing-translations, and /translate:

Config example:

Rules:

Runtime registration example:

When authorization is configured, /models and /missing-translations automatically filter out models the current request is not allowed to access.

Scheduled Missing Translation Runs

The service provider can auto-register a scheduler entry for translatable:translate-missing.

When enabled, the package adds this command to Laravel's scheduler with the configured cron expression.

Configuration Reference

config/translatable.php exposes these feature flags and integration points:

Bruno Collection

Publish the Bruno collection with:

Or publish it during setup with:


All versions of translatable with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
illuminate/contracts Version ^12.0 || ^13.0
illuminate/database Version ^12.0 || ^13.0
illuminate/http Version ^12.0 || ^13.0
illuminate/queue Version ^12.0 || ^13.0
illuminate/support Version ^12.0 || ^13.0
laravel/ai Version ^0.6.3
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 pictastudio/translatable contains the following files

Loading the files please wait ...