Skip to content

Route caching doesn't work in Laravel 11 #927

@vincentsch

Description

@vincentsch

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions