Download the PHP package brunoscode/twill-translation-handler without Composer

On this page you can find all versions of the php package brunoscode/twill-translation-handler. 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 twill-translation-handler

Twill Translation Handler

Latest Version on Packagist GitHub Tests Action Status Total Downloads

A Twill CMS capsule for managing Laravel translations directly from the admin panel. Built on top of LaravelTranslationHandler.

Twill compatibility: Currently supports Twill 3 (Laravel 11–12, PHP 8.2+). Twill 2 support is available in the v0.x releases.

Supported versions

Package version PHP Laravel Twill
v2.1 8.2 · 8.3 · 8.4 11 · 12 3.x
v2.0 8.2 · 8.3 11 3.x
v1.x 8.1+ 10 2.x

Features

Requirements

Installation

Run the migrations:

Publish the config file:

Optionally publish the views to customise them:

Navigation

The package provides three sub-pages:

TwillNavigation builder

If your app uses the newer TwillNavigation builder API, disable the automatic registration in config/translation-handler.php:

Then register the entries in your AppServiceProvider (or wherever you build your Twill navigation):

If you have a custom admin_route_name_prefix, replace twill. accordingly:

Legacy twill-navigation config array

By default the package registers the navigation automatically via the legacy twill-navigation config array. The package will merge the translations key into the array at boot. To control where it appears in the sidebar, add an empty placeholder in the right position — PHP arrays preserve the insertion order of existing keys:

Configuration

See LaravelTranslationHandler for the full list of configuration options.

Usage

Once installed, a Translations section will appear in the Twill admin navigation with three pages:

Keys

Lists all translation keys stored in the database. Each key can be opened to edit its translated value for every configured locale. Translation keys are managed exclusively through import — manual creation is intentionally disabled to keep the database in sync with source files.

Groups

Lists all translation groups, auto-generated from the key prefixes. Opening a group shows all matching keys in a repeater, allowing batch editing of every locale's value from a single form.

Import / Export

A tools page with actions to sync translations:

Action Description
Import from CSV Uploads a CSV file, imports all translations into the database, and writes the PHP language files
Export to CSV Downloads all database translations as a CSV file

Per-group CSV export is also available directly from each group's edit page.

CSV import rules

PHP language files are kept in sync automatically: every import (CSV via the tools page or per-group) writes the affected PHP files immediately after updating the database. Saving a single key or group from the edit form also triggers the same export.

Editorial interface

Editing a key

Opening a translation key shows:

Field Behaviour
Key Read-only. Keys are created only via import.
Value Translatable textarea — one tab per configured locale.
Allow empty Checkbox (sidebar). See below.

Saving a key immediately exports the affected PHP language file.

Editing a group

Opening a group shows the prefix (read-only) and one textarea per translation key that belongs to the group. Each textarea is translatable — every configured locale is available as a tab. A Download CSV button lets editors export the group directly from the edit page.

Field naming: each textarea is internally keyed as trans_<id> where <id> is the translation_keys.id. This is transparent to editors but relevant if you extend the form.

Saving a group writes all locale values and immediately exports the affected PHP language file.

allow_empty

Both modules show an Allow empty checkbox in the sidebar. Its effect is on form validation:

Module allow_empty unchecked allow_empty checked
Keys Value is required for every locale Value is nullable — empty strings are accepted
Groups Every locale value of every key is required No validation — any combination of values is accepted

When a value reaches the repository as null (e.g. the editor cleared a field), it is normalised to an empty string before being persisted. This means the database never stores null in translation_values.value through a form save.

Deployment

The database is the source of truth for translation values. PHP language files are used only to carry new keys and new locales between environments.

A typical deploy script:

The first command (without --force) inserts only keys and locale entries that do not yet exist in the DB — existing values are left untouched. The second command rewrites the PHP files so they always reflect the DB state.

First deploy / fresh environment: if the DB is empty, seed it from the PHP files:

Syncing translations from production

When content editors have updated translations directly in production or staging, you can pull those changes back into the repository:

  1. Download the CSV from the production admin panel via Translations → Import / Export → Export to CSV.

  2. Copy the file into your project (e.g. storage/lang/translations.csv) and import it to regenerate the PHP files:

  3. Commit the updated PHP files and push:

The next deploy will import the updated PHP files into any environment whose DB does not yet have those values.

Database Structure

Table Description
translation_keys Translation keys (key, published)
translation_values Per-locale values (locale, value, active)
translation_groups Group prefixes (prefix, published)

Testing

Changelog

Please see CHANGELOG for recent changes.

Credits

License

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


All versions of twill-translation-handler with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
area17/twill Version ^3.0
laravel/framework Version ^11.0|^12.0
spatie/laravel-package-tools Version ^1.16
brunoscode/laravel-translation-handler Version ^2.2
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 brunoscode/twill-translation-handler contains the following files

Loading the files please wait ...