1. Go to this page and download the library: Download achyutn/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/ */
achyutn / laravel-seo example snippets
use AchyutN\LaravelSEO\Traits\InteractsWithSEO;
class Post extends Model
{
use InteractsWithSEO;
// ...
}
use AchyutN\LaravelSEO\Contracts\HasMarkup;
use AchyutN\LaravelSEO\Schemas\BlogSchema;
class Post extends Model implements HasMarkup
{
use InteractsWithSEO;
use BlogSchema;
// ...
}
use AchyutN\LaravelSEO\Contracts\HasMarkup;
use AchyutN\LaravelSEO\Schemas\ProductSchema;
class Product extends Model implements HasMarkup
{
use InteractsWithSEO;
use ProductSchema;
// ...
}
use AchyutN\LaravelSEO\Contracts\HasMarkup;
use AchyutN\LaravelSEO\Schemas\PageSchema;
class Page extends Model implements HasMarkup
{
use InteractsWithSEO;
use PageSchema;
// ...
}
use AchyutN\LaravelSEO\Data\Breadcrumb;
class Post extends Model
{
use InteractsWithSEO;
public function breadcrumbs(): array
{
return [
new Breadcrumb(label: 'Home', url: route('home')),
new Breadcrumb(label: 'Blog', url: route('blog.index')),
new Breadcrumb(label: $this->title, url: route('blog.show', $this)),
];
}
}
class Product extends Model
{
use InteractsWithSEO;
protected function priceValue(): ?float
{
return $this->price;
}
protected function availabilityValue(): bool
{
return $this->is_available;
}
}
class Product extends Model
{
use InteractsWithSEO;
protected string $priceColumn = 'product_price';
protected string $brandColumn = 'product_brand';
}