sabuj073/laravel-seo

Laravel SEO package for per-page meta tags, Open Graph and Twitter Card

Maintainers

Package info

github.com/sabuj073/laravel-seo

pkg:composer/sabuj073/laravel-seo

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

dev-main 2026-03-10 05:03 UTC

This package is auto-updated.

Last update: 2026-03-10 05:09:37 UTC


README

Per-page SEO meta tags for Laravel: title, description, image, canonical, Open Graph and Twitter Card.

Installation

composer require sabuj073/laravel-seo
php artisan vendor:publish --tag=seo-config
# optional views
php artisan vendor:publish --tag=seo-views

Configuration

In .env:

SEO_DEFAULT_TITLE="My Site"
SEO_DEFAULT_DESCRIPTION="Default meta description"
SEO_DEFAULT_IMAGE="https://yoursite.com/og-default.jpg"
SEO_TITLE_SEPARATOR=" | "

Usage

In controllers or middleware, set SEO for the current page:

use Sabuj073\Seo\Seo;

public function show(Post $post, Seo $seo)
{
    $seo->title($post->title)
        ->description(Str::limit($post->excerpt, 160))
        ->image($post->featured_image_url)
        ->canonical(route('posts.show', $post))
        ->keywords($post->tags->pluck('name')->toArray())
        ->ogType('article');
    return view('posts.show', compact('post'));
}

In your main layout (e.g. resources/views/layouts/app.blade.php), inside <head>:

{!! app(\Sabuj073\Seo\Seo::class)->render() !!}

Or register a facade in config/app.php:

'aliases' => [
    'Seo' => \Sabuj073\Seo\SeoFacade::class,
],

Then in layout:

{!! Seo::render() !!}

Chaining:

Seo::title('Contact')
    ->description('Get in touch with us')
    ->canonical(route('contact'));

Default title is appended with SEO_TITLE_SEPARATOR and SEO_DEFAULT_TITLE when you set a page title.