czim / laravel-localization-route-cache
Translated route caching solution for laravel localization
Installs: 168 121
Dependents: 1
Suggesters: 0
Security: 0
Stars: 47
Watchers: 3
Forks: 14
Open Issues: 0
Requires
- php: >=5.5.9
- mcamara/laravel-localization: ^1.1
Requires (Dev)
- orchestra/testbench: ~3.0
- phpunit/phpunit: 4.*
- scrutinizer/ocular: ~1.1
README
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
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.