dejwcake / craftable-translatable
Make your Eloquent models and other content translated into multiple languages
Package info
github.com/dejwCake/craftable-translatable
pkg:composer/dejwcake/craftable-translatable
Requires
- php: ^8.5
- ext-json: *
- laravel/framework: ^13.0
- spatie/laravel-translatable: ^6.13
Requires (Dev)
- larastan/larastan: ^3.9
- orchestra/testbench: ^11.1
- phpunit/phpunit: ^13.1
This package is auto-updated.
Last update: 2026-08-06 16:34:13 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
HasTranslationstrait that makes your Eloquent model translatable (extendingspatie/laravel-translatable), - provides a
WithTranslationsinterface that marks your Eloquent model as translatable (the trait will also work without this interface), - provides a
TranslatableFormRequestclass 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 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 ./config,./src,./tests ansi phpmd.xml --suffixes php --baseline-file phpmd.baseline.xml
Run tests
Run tests against mariadb:
docker compose run -it --rm -e DB_CONNECTION=mysql test ./vendor/bin/phpunit
Run tests against postgresql:
docker compose run -it --rm -e DB_CONNECTION=pgsql test ./vendor/bin/phpunit
Run tests with coverage:
docker compose run -it --rm test ./vendor/bin/phpunit --coverage-text
Run the whole PHP suite
Run every PHP check and the test suite against both databases in sequence (stops at the first failure):
docker compose run -it --rm test composer update \ && docker compose run -it --rm php-qa composer normalize \ && docker compose run -it --rm php-qa phpcs --standard=.phpcs.compatibility.xml --cache=.phpcs.cache \ && docker compose run -it --rm php-qa phpcs -s --colors --extensions=php \ && docker compose run -it --rm php-qa phpstan analyse --configuration=phpstan.neon \ && docker compose run -it --rm php-qa phpmd ./config,./src,./tests ansi phpmd.xml --suffixes php --baseline-file phpmd.baseline.xml \ && docker compose run -it --rm -e DB_CONNECTION=mysql test ./vendor/bin/phpunit \ && docker compose run -it --rm -e DB_CONNECTION=pgsql test ./vendor/bin/phpunit