| Package Data | |
|---|---|
| Maintainer Username: | crumby | 
| Maintainer Contact: | avassilenko2@gmail.com (Andrei Vassilenko) | 
| Package Create Date: | 2017-08-14 | 
| Package Last Update: | 2017-09-24 | 
| Language: | PHP | 
| License: | MIT License | 
| Last Refreshed: | 2025-10-26 15:00:58 | 
| Package Statistics | |
|---|---|
| Total Downloads: | 38 | 
| Monthly Downloads: | 0 | 
| Daily Downloads: | 0 | 
| Total Stars: | 0 | 
| Total Watchers: | 0 | 
| Total Forks: | 0 | 
| Total Open Issues: | 0 | 
> composer require crumby/canonical-hreflang
> php artisan vendor:publish --provider="Crumby\CanonicalHreflang\CanonicalHreflangServiceProvider" --tag=config
File: config/app.php
'providers' => [
    ......................
    'Crumby\CanonicalHreflang\CanonicalHreflangServiceProvider',
    ........................
 ];
 
 'aliases' => [ 
    ......................
    'Canonicalhreflang' => 'Crumby\CanonicalHreflang\Facades\CanonicalHreflang',
    ......................
 ];
file app/Http/Kernel.php
protected $middleware = [
        .............................
        \Crumby\CanonicalHreflang\Middleware\CanonicalHreflangMiddleware::class
    ];
Besides automatically set canonical url links to head, it also sets Hreflang, if unabled. config/canonical-hreflang.php
    'multilangular' => true
add middleware to constructor of your controller
    class StaticPagesController extends Controller {
        public function __construct()
        {
            ...........................
            $this->middleware('CanonicalHreflang');
            ...........................
        }
    }
place this variable to your Blade template head section
{!! $CanonicalHreflang !!} 
API documentation