- How do I install Laravel Lang: Config in my Laravel project?
- Run `composer require laravel-lang/config` in your project directory. The package integrates automatically via Laravel’s service provider system—no additional setup is required unless you need to publish or customize the default config files.
- Which Laravel versions does this package support?
- Laravel Lang: Config supports Laravel 11–13. If you’re using Laravel 10 or earlier, this package is not compatible, as it was designed for newer Laravel features like the updated configuration system.
- Can I use this package with custom locale directories or non-PHP formats like JSON/YAML?
- Yes, the package supports custom paths and fallbacks. While it defaults to PHP-based locales, you can extend it to load JSON/YAML files by configuring custom loaders in your `config/lang.php` or by overriding the `LaravelLangConfigServiceProvider` bindings.
- How do I publish and customize the default config files?
- Run `php artisan vendor:publish --tag=laravel-lang-config` to publish the config files to `config/lang.php`. Edit the published file to override defaults, or create environment-specific files like `lang-local.php` for per-environment overrides.
- Does this package work with other Laravel-Lang packages like `laravel-lang/lang`?
- Yes, it’s designed to complement the Laravel-Lang ecosystem. The config package provides standardized defaults that align with other Laravel-Lang tools, ensuring consistency across your multilingual workflow.
- What if I need dynamic locales or database-driven translations?
- This package is optimized for static, file-based locales. For dynamic or database-driven translations, you’ll need to build custom logic on top of Laravel’s existing localization system or consider alternatives like Spatie’s localization packages.
- How do I access the configuration programmatically?
- Use the `LaravelLangConfig` facade to interact with the config. For example, `LaravelLangConfig::meta()` retrieves metadata, and `LaravelLangConfig::initialize()` ensures the config is loaded. You can also access values directly via Laravel’s `config()` helper.
- Is there a risk of breaking changes during updates?
- The package follows semantic versioning, but since it’s part of the Laravel-Lang ecosystem, updates may align with Laravel’s release cycles. Always review the changelog and test updates in a staging environment to avoid compatibility issues.
- What are the alternatives to Laravel Lang: Config for Laravel localization?
- Alternatives include Spatie’s `laravel-translatable` for dynamic translations, Symfony’s `Intl` components for locale handling, or custom solutions using Laravel’s built-in localization features. This package is ideal if you’re already using Laravel-Lang tools.
- How do I handle multi-region deployments or nested locale structures?
- The package supports environment-specific overrides via `.env` or custom config files. For nested locales, extend the `LaravelLangConfigServiceProvider` to define custom loader logic or use Laravel’s `App::setLocale()` dynamically in your routes or middleware.