Download the PHP package givanov95/laravel-translations without Composer
On this page you can find all versions of the php package givanov95/laravel-translations. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download givanov95/laravel-translations
More information about givanov95/laravel-translations
Files in givanov95/laravel-translations
Package laravel-translations
Short Description Multi-locale translation infrastructure for Laravel + Inertia + Vue projects: polymorphic Translation model, HasTranslation trait, JSON-backed Translator, locale middlewares, MultiSelect helpers.
License MIT
Informations about the package laravel-translations
givanov95/laravel-translations
Multi-locale translation infrastructure for Laravel + Inertia + Vue projects.
What's included
Translationpolymorphic Eloquent model — store any model's translatable text per localeHasTranslationtrait —setTranslation(),loadTranslations(),withTranslations()scopeTranslatorservice — cached JSON loader,getAllLocales(), model relation key mappingInitAppLocale+InitLocalePrefixmiddlewaresMultiSelectService— load select options from any Eloquent model, with optional translation lookupMultiSelectDataConversiontrait — turn a PHP enum into select option arraysTranslationPlugin.ts— Vue plugin exposing__('key', { name: 'value' })
The package is enum-agnostic — your project keeps its own Locale enum and passes either Locale::en or the plain 'en' string. Internally everything works with strings.
Install
Setup
1. Locale enum (project-side)
Create app/Enums/Locale.php in your project (the package doesn't ship one — locales differ per project):
2. Lang files
Create lang/en.json, lang/bg.json etc. with your translations:
3. Register middlewares (bootstrap/app.php)
4. Share with Inertia
In app/Http/Middleware/HandleInertiaRequests.php:
5. Install the Vue plugin (resources/js/app.ts)
Usage
On models
Select options from a model
Enum to options
In Vue templates
Development
Pre-commit hook
composer install / composer update symlinks the repo's pre-commit script into .git/hooks/pre-commit. It runs composer test + composer analyse before any commit that touches .php files — replacement for CI since the repo is private.
Bypass with git commit --no-verify when you genuinely need to (WIP commit, doc-only change you've already validated).
License
MIT
All versions of laravel-translations with dependencies
illuminate/contracts Version ^11.0|^12.0|^13.0
illuminate/support Version ^11.0|^12.0|^13.0
illuminate/database Version ^11.0|^12.0|^13.0
illuminate/http Version ^11.0|^12.0|^13.0
illuminate/cache Version ^11.0|^12.0|^13.0
illuminate/filesystem Version ^11.0|^12.0|^13.0