- What is akaunting/laravel-language used for in Laravel?
- It is a database-driven language and translation manager for Laravel. You can add, edit, and switch languages at runtime, store translation lines in the database, and set the active locale per request with included middleware. The package provides models, routes, and a service provider for integration.
- How do I install akaunting/laravel-language with Composer?
- Install it with composer require akaunting/laravel-language and follow the repository README for service provider registration, config publishing, and migrations. Publish only the assets and migrations you need, then confirm the package's Composer constraints match your PHP and Laravel versions. Test installation on a non-production branch before rolling it out.
- Does akaunting/laravel-language store translations in the database?
- Yes, the package is described as database-driven and stores translation lines in the database. It includes models and routes for managing languages and translations. Confirm the exact schema, fallback behavior, and caching approach in the package source and docs before replacing Laravel language files.
- How does the package set the active Laravel locale per request?
- It includes built-in middleware that sets the active locale per request. You typically register the middleware in your HTTP stack and pair it with your language-selection or session logic. Review the middleware priority and resolution order so it does not conflict with existing locale middleware.
- Can users switch languages at runtime without redeploying?
- Yes, the package is designed for adding, editing, and switching languages at runtime. Language and translation records live in the database, so changes can be made through the included routes and models. You should still control who can edit translations and clear any relevant caches after changes.
- Do I need to publish config and run migrations for akaunting/laravel-language?
- Plan to publish the package config and run its migrations if you want database-backed languages and translations. The exact commands depend on the release, so follow the README and inspect the service provider. Use optional migrations only where needed and diff published config during upgrades.
- Which Laravel and PHP versions does akaunting/laravel-language support?
- The technical evaluation notes broad Laravel 8 through 12 support, but you must verify the composer.json constraints for the exact package version you install. PHP compatibility can vary by Laravel version, so build a small compatibility matrix for your estate. Pin the package version and test the specific PHP/Laravel combination you plan to run.
- Is akaunting/laravel-language suitable for per-user or multi-tenant locale switching?
- The package provides middleware for setting the active locale per request, which can be combined with your own user or tenant resolution logic. It is not enough on its own to define multi-tenant isolation, override precedence, or authorization for translation editing. Add explicit middleware ordering, permission checks, and tests for tenant-specific behavior.
- How should I test language switching in a Laravel application?
- Write feature tests that hit your routes with different locale inputs and assert the response language, session state, and middleware behavior. Test config caching, database translation lookups, fallback locales, and unauthorized access to translation management routes. Also verify behavior under long-running workers or Octane if your app uses them.
- What should I check before using akaunting/laravel-language in production?
- Pin the exact version and review the changelog, upgrade notes, support policy, and security disclosure process. Confirm override and locale resolution order, cache invalidation, and who can edit database translations. Run a staging pilot and document rollback before enabling it broadly.