Download the PHP package outerweb/filament-translatable-fields without Composer

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

Filament Translatable Fields

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This Filament plugin provides an integration for the spatie/laravel-translatable package.

It can easily be combined with the lara-zeus/translatable package as our package only provides the Form integration. To do so, simply remove all lara-zeus specific code from the Create and Edit pages of your Filament Resources.

Instead of rendering a dropdown to select the locale, it wraps the translatable fields in a Tabs component for a better user experience.

⚠️ Caution: V4 is a complete rewrite of the package and logic. Please take a look at the installation instructions below!

Table of Contents

Installation

You can install the package via composer:

Add the plugin to your panel:

Configuration

Supported locales

By default, the package will try to read out the supported locales from the config/app.php file. It will check for app.supported_locales first and then fallback to app.locales and app.fallback_locale.

You can manually configure the supported locales like this:

If you want to provide custom labels for the locales, you can do it like this:

If you want to dynamically provide the supported locales, you can also pass a Closure to the supportedLocales() method:

Default locale

By default, the active tab will be the one of the app's locale when rendering the form. You can change this behavior by setting a default locale:

If you want to dynamically provide the default locale, you can also pass a Closure to the defaultLocale() method:

Usage

Marking single fields as translatable

To mark a single field as translatable, you can use the translatable() method on any Filament form field:

This will wrap the field in a Tabs component with a tab for each supported locale.

Note: Make sure to place the translatable() method at the end of the field definition to avoid any unexpected behavior.

Modifying/Validating a field for a specific locale

All modifiers and validation rules applied before calling the translatable() method will be applied field for each locale. If you want to apply a modifier or validation rule for a specific locale only, you can use the modifyLocalizedFieldUsing parameter in the translatable() method:

Conditionally marking a field as translatable

You can also conditionally mark a field as translatable by passing a bool or Closure to the translatable() method:

Overriding the supported locales for a single field

You can override the supported locales for a single field by passing an array or Closure to the translatable() method:

Overriding the default locale for a single field

You can override the default locale for a single field by passing a string or Closure to the translatable() method:

Marking a group of fields as translatable

You can also mark a Layout component as translatable. This will make all fields inside the layout translatable:

This will wrap all fields inside the layout in a Tabs component with a tab for each supported locale.

Note: Make sure to place the translatable() method at the end of the component definition to avoid any unexpected behavior.

All the options described for single fields (modifying/validating a field for a specific locale, conditionally marking as translatable, overriding supported/default locales) are also available when marking a layout component as translatable.

For modifying/validating fields inside a layout component, the provided Closure will be called for each field inside the layout.

Example:

Changelog

Please see CHANGELOG for more information on what has changed recently.

License

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


All versions of filament-translatable-fields with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
filament/filament Version ^4.0|^5.0
spatie/laravel-package-tools Version ^1.16
spatie/laravel-translatable Version ^6.12
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 outerweb/filament-translatable-fields contains the following files

Loading the files please wait ...