PHP code example of basekit-laravel / basekit-laravel-seo

1. Go to this page and download the library: Download basekit-laravel/basekit-laravel-seo library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

basekit-laravel / basekit-laravel-seo example snippets


public function show(Article $article)
{
    seo()
        ->title($article->title)
        ->description($article->excerpt)
        ->canonicalUrl(route('articles.show', $article));

    return view('articles.show', [
        'article' => $article,
    ]);
}

seo()
    ->title('About us')
    ->description('Learn more about our company.')
    ->canonicalUrl(route('about'))
    ->robots('index, follow')
    ->locale('en_US');

seo()->for($article);

seo()
    ->for($article)
    ->title('Custom title');

seo()->canonicalUrl(
    route('articles.show', $article)
);

seo()->alternate('de', 'https://example.com/de/about');
seo()->alternate('en', 'https://example.com/en/about');

app(SitemapCache::class)->clear();
app(SitemapGenerator::class)->regenerateNow();

'sitemap' => [
    'middleware' => ['throttle:60,1'],
],
bash
php artisan vendor:publish --tag="basekit-laravel-seo-config"
bash
php artisan basekit-seo:sitemap:warm
php artisan basekit-seo:sitemap:clear
bash
php artisan vendor:publish --tag="basekit-laravel-seo-views"