dejwcake/craftable-translatable

Make your Eloquent models and other content translated into multiple languages

Installs: 662

Dependents: 3

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 9

Type:project

pkg:composer/dejwcake/craftable-translatable

1.0.1 2026-01-17 20:57 UTC

This package is auto-updated.

Last update: 2026-01-17 21:08:05 UTC


README

Translatable makes your content easily translatable into the locales (languages) you define. In short, the package:

  • publishes a config file that defines the locales (languages) used in your project,
  • provides a HasTranslations trait that makes your Eloquent model translatable (extending spatie/laravel-translatable),
  • provides a WithTranslations interface that marks your Eloquent model as translatable (the trait will also work without this interface),
  • provides a TranslatableFormRequest class you can use as a base for your form request classes, simplifying the definition of validation rules for translatable data.

Documentation

You can find full documentation at https://docs.getcraftable.com/#/translatable

How to develop this project

Composer

Update dependencies:

docker compose run -it --rm test composer update

Composer normalization:

docker compose run -it --rm php-qa composer normalize

Run tests

Run tests with pcov:

docker compose run -it --rm test ./vendor/bin/phpunit -d pcov.enabled=1

To switch between postgresql and mariadb change in docker-compose.yml DB_CONNECTION environmental variable:

- DB_CONNECTION: pgsql
+ DB_CONNECTION: mysql

Run code analysis tools (php-qa)

PHP compatibility:

docker compose run -it --rm php-qa phpcs --standard=.phpcs.compatibility.xml --cache=.phpcs.cache

Code style:

docker compose run -it --rm php-qa phpcs -s --colors --extensions=php

Fix style issues:

docker compose run -it --rm php-qa phpcbf -s --colors --extensions=php

Static analysis (phpstan):

docker compose run -it --rm php-qa phpstan analyse --configuration=phpstan.neon

Mess detector (phpmd):

docker compose run -it --rm php-qa phpmd ./src,./install-stubs,./tests ansi phpmd.xml --suffixes php --baseline-file phpmd.baseline.xml