1. Go to this page and download the library: Download fomvasss/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/ */
fomvasss / laravel-seo example snippets
namespace App\Models;
use Fomvasss\Seo\Models\HasSeo;
class PostModel extends Model {
use HasSeo;
//...
public function registerSeoDefaultTags(): array
{
return [
'title' => $this->name,
'description' => $this->description,
'og_image' => $this->getFirstMediaUrl('images', 'thumb'),
];
}
}
Seo::setDefault(['title' => 'Blog']);
Seo::setModel($post);
Seo::setPath('page/faq');
Seo::setTags(['keywords' => 'Laravel, SEO, tags']);