Looking to hire Laravel developers? Try LaraJobs

laravel-seo maintained by fomvasss

Description
Laravel SEO package
Author
Last update
2026/05/30 18:55 (1.13.0)
License
Downloads
2 467

Comments
comments powered by Disqus

Laravel SEO package

License Build Status Latest Stable Version Total Downloads Quality Score

Support

If this package is useful to you, consider supporting its development:

Monobank Ko-Fi USDT TRC20

USDT TRC20 address: THLgp6DxiAtbNHvgnKV56vk1L38UuUagKf

With this package you can manage meta-tags and SEO-fields from Laravel app.

Installation

You can install the package via composer:

composer require fomvasss/laravel-seo

You can publish and run the migrations with:

php artisan vendor:publish --provider="Fomvasss\Seo\SeoServiceProvider"
php artisan migrate

Usage

The Eloquent model must has the Trait HasSeo:

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'),
        ];
    }
}

Also in model you can define default tags in method registerSeoDefaultTags

Allowed next methods (By increasing priority):

Seo::setDefault(['title' => 'Blog']);
Seo::setModel($post);
Seo::setPath('page/faq');
Seo::setTags(['keywords' => 'Laravel, SEO, tags']);

Rendering tags in Blade (in HTML head):

{!!
\Seo::setGroup(app()->getLocale())
    ->setDefault([
        'og_site_name' => config('app.name'),
        'og_url' => URL::full(),
        'og_locale' => app()->getLocale(),
    ])->renderHtml()
!!}

Get array tags (for API resource, etc.):

\Seo::setGroup(app()->getLocale())
    ->setDefault([
        'og_site_name' => config('app.name'),
        'og_locale' => app()->getLocale(),
    ])->getTags();

You can save tags for model in DB:

$post->seo('uk')->updateOrCreate([], ['tags' => ['title' => 'Hello Page', 'description' => 'Lorem Ipsum'], 'group' => 'uk']);

And get tags (for edit) for dashboard:

$tags = $post->getRawSeoTags('uk');

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.