Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Route caching doesn't work in Laravel 11 #927

Open
vincentsch opened this issue Jan 4, 2025 · 1 comment
Open

Route caching doesn't work in Laravel 11 #927

vincentsch opened this issue Jan 4, 2025 · 1 comment
Labels

Comments

@vincentsch
Copy link

vincentsch commented Jan 4, 2025

Describe the bug
Route caching doesn't work in Laravel 11. The package's caching documentation relies on RouteServiceProvider which has been removed in Laravel 11.

To Reproduce

  1. Create new Laravel 11 project
  2. Install mcamara/laravel-localization
  3. Follow caching setup guide at https://github.com/mcamara/laravel-localization/blob/master/CACHING.md
  4. Get error when running artisan route:trans:cache because RouteServiceProvider doesn't exist
  5. Without those modifications get 404 errors on localized routes after caching routes

Expected behavior
Route caching should work with Laravel 11's new routing system

More info:

  • Laravel Version: 11.x
  • Laravel-localization Version: 1.8.2
  • Middleware: localize, localizationRedirect, localeCookieRedirect, localeViewPath
  • Config:
'supportedLocales' => [
    'en' => ['name' => 'English', 'script' => 'Latn', 'native' => 'English', 'regional' => 'en_GB'],
    'de' => ['name' => 'German', 'script' => 'Latn', 'native' => 'Deutsch', 'regional' => 'de_DE']
],
'useAcceptLanguageHeader' => false,
'hideDefaultLocaleInURL' => true

Additional context
Current caching documentation at https://github.com/mcamara/laravel-localization/blob/master/CACHING.md is incompatible with Laravel 11.

@iwasherefirst2
Copy link
Collaborator

Thank you for reporting this bug. Unfortunately, I’m not aware of a simple workaround for version 11 at the moment. However, we are actively working on version 3 of this package, which will eliminate the need for custom caching and fully leverage Laravel’s built-in cache. This update will resolve the issue once it’s ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants