czim/laravel-localization-route-cache

This package is abandoned and no longer maintained. No replacement package was suggested.

Translated route caching solution for laravel localization

0.9.9 2018-08-03 17:11 UTC

This package is auto-updated.

Last update: 2020-01-19 18:56:05 UTC


README

Software License

Important: This solution has been merged into mcamara/laravel-localization since version 1.3.11. This package is no longer required!

A cobbled together fix to allow caching routes per locale for mcamara's laravel localization.

See the github issue related to this fix in the original package.

This has been tested with laravel 5.1 through 5.6.

Version Compatibility

Laravel Package
5.1.x 0.8.x
5.2.x and up 0.9.x

Change log

View the change log.

Install

Via Composer

$ composer require czim/laravel-localization-route-cache

If you don't use auto-discovery, add the service provider after mcamara's in your config/app.php:

    Mcamara\LaravelLocalization\LaravelLocalizationServiceProvider::class,
    Czim\LaravelLocalizationRouteCache\LaravelLocalizationServiceProvider::class,

In your App's RouteServiceProvider, use the LoadsTranslatedCachedRoutes trait:

class RouteServiceProvider extends ServiceProvider
{
    use \Czim\LaravelLocalizationRouteCache\Traits\LoadsTranslatedCachedRoutes;

Usage

To cache your routes, use

    php artisan route:trans:cache

instead of the normal route:cache command.

To list the routes for a given locale, use

    php artisan route:trans:list {locale}
    
    # for instance:
    php artisan route:trans:list en

To clear cached routes for all locales, use

    php artisan route:trans:clear

Note that using route:clear will also effectively unset the cache (at the minor cost of leaving some clutter in your bootstrap/cache directory).

Credits

License

The MIT License (MIT). Please see License File for more information.