avassilenko / route-locale by crumby

Localized Url builder for Laravel 5.4
82
0
0
Package Data
Maintainer Username: crumby
Maintainer Contact: avassilenko2@gmail.com (Andrei Vassilenko)
Package Create Date: 2017-08-14
Package Last Update: 2017-09-19
Language: PHP
License: MIT License
Last Refreshed: 2024-12-15 15:05:31
Package Statistics
Total Downloads: 82
Monthly Downloads: 3
Daily Downloads: 0
Total Stars: 0
Total Watchers: 0
Total Forks: 0
Total Open Issues: 0

Installation:

> 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" />