Download the PHP package visual-ideas/moonshine-spatie-translatable without Composer

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

Spatie\Translatable field for MoonShine Laravel admin panel

Latest Version on Packagist Total Downloads

Extends the MoonShine JSON field to work with spatie/laravel-translatable. Provides a full interface for editing multi-language model attributes inside MoonShine resources.

Compatibility

MoonShine Package Supported
>= v1.0 ^1.0 no
>= v2.0 ^2.0 yes
>= v3.0 ^3.0 yes
>= v4.0 ^3.0 yes

Installation

This field belongs to a separate package — complete installation before using it.

For MoonShine 2.* use ^2.0 instead.

The package registers automatically via Laravel's package auto-discovery. If you have disabled auto-discovery, register the service provider manually:

For Laravel 11+, add VI\MoonShineSpatieTranslatable\ServiceProvider::class to bootstrap/providers.php instead.

Requirements

Assets

Publish assets for the compact mode styles:

Basic usage

The field renders as a key-value JSON list where each row has a language code (Select) and a value (Text input by default).

⚠️ The onlyValue() method (inherited from the parent Json field) is not supported — translatable fields always require both a language key and a value.

How it works

The field integrates with spatie/laravel-translatable at the model level:

  1. Storage — Spatie stores all translations as a JSON object in a single database column (e.g., {"lv": "Nosaukums", "en": "Title", "ru": "Название"})
  2. Reading — The field calls $model->getTranslations('column') to retrieve existing translations and converts them into key-value pairs for the form ([{key: 'lv', value: 'Nosaukums'}, ...])
  3. Saving — On form submit, the field converts the key-value pairs back into a translations array and calls $model->replaceTranslations('column', [...])

The underlying UI is MoonShine's Json field with a language code Select and a value input.

Language configuration

languages(array $codes)

Restrict the language list to specific codes. By default ~120 common locale codes are available.

requiredLanguages(array $codes)

Languages to place at the very top of the list, before priorityLanguages. Useful for highlighting important locales.

priorityLanguages(array $codes)

Bring certain languages to the top of the list in the form.

Merge order: requiredLanguages first, then priorityLanguages, then all languages.

Input field type

By default the value input is a single-line Text field. You can switch to other field types.

textarea()

tinyMce()

Requires moonshine/tinymce package.

json()

customInputField(string $fieldClass)

Any MoonShine field class that extends MoonShine\UI\Fields\Field.

Compact mode

The field can render as a compact tabbed interface — language badges at the top, one visible editor at a time.

Features:

Removing translations

The removable() method works in both modes (default key-value and compact). It adds a remove button to each translation row.

⚠️ If you leave the translation text blank, it will be deleted on save. If there are two translations for the same language, the first one is removed (replaced).

License

The MIT License (MIT). See LICENSE.md for more information.


All versions of moonshine-spatie-translatable with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0|^8.1|^8.2|^8.3|^8.4|^8.5
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 visual-ideas/moonshine-spatie-translatable contains the following files

Loading the files please wait ...