crumby / route-locale
Localized Url builder for Laravel 5.4
1.0.0
2017-08-18 06:01 UTC
Requires
- php: >=5.6.0
- crumby/route-resolver: *
This package is not auto-updated.
Last update: 2024-11-10 04:27:45 UTC
README
> composer require crumby/route-locale:"dev-master"
> php artisan vendor:publish --provider="Crumby\Routelocale\RoutelocaleServiceProvider" --tag=config
Register service and facade:
File: config/app.php
'providers' => [
......................
'Crumby\Routelocale\RoutelocaleServiceProvider',
........................
];
'aliases' => [
......................
'Routelocale' => 'Crumby\Routelocale\Facades\Routelocale',
......................
];
Example of building all existing localized urls for current route:
$allLocalizedUrls = \Routelocale::getAllLocalizedRoutes(null, false, true);
will output url used in hreflang:
<link rel="canonical" href="http://dev.myblogtest.com/packages/breadcrumbs-for-laravel-54" />
<link rel="alternate" hreflang="en" href="http://dev.myblogtest.com/packages/breadcrumbs-for-laravel-54" />
<link rel="alternate" hreflang="ru" href="http://dev.myblogtest.com/ru/packages/khlebnyekroshki-dlya-laravel-54" />