Laravel Packagev13.xMIT License833+ downloads

SEO: Every page, ready to be found and shared

SEO sets the title, meta tags, canonical and alternate links, Open Graph and Twitter cards of each page from a controller, a model or a view, and prints them all with @seo.

$composer require pharaonic/laravel-seo
Key Features

Everything a page needs to be found and shared

Set a value anywhere in the request; one directive prints the tags.

Meta Tags

Charset, viewport, <title>, description, keywords, author, robots and copyright.

Canonical & hreflang

Canonical URL, next and previous pages, and one alternate link per language.

Open Graph & Twitter

Both cards reuse the page title, description and images, so you set them once.

Eloquent Models

A model returns its SEO data from seo(), and seo()->model($post) applies it.

Blade Directives

@seoTitle, @seoImage and friends set tags from a view; @seo prints them.

Safe by Default

Every value is HTML-escaped, and tags never leak between Octane requests or queued jobs.

A quick look

Set the tags in a controller, print them in the layout.

app/Http/Controllers/PostController.php
1public function show(Post $post)
2{
3 seo()->title->set($post->title);
4 seo()->description->set($post->excerpt);
5 seo()->images->add($post->cover_url);
6 seo()->canonical->set(route('posts.show', $post));
7 seo()->openGraph->setType('article');
8 
9 return view('posts.show', compact('post'));
10}
11 
12// resources/views/layouts/app.blade.php: <head> @seo </head>
FAQ

SEO Questions

Quick answers about installing and using SEO.

What is SEO?

Titles, meta tags, canonical and alternate links, Open Graph and Twitter cards for Laravel, set from controllers, Eloquent models or Blade and printed with one directive. It's a free, open-source Laravel package by Pharaonic.

How do I install SEO?

Run composer require pharaonic/laravel-seo in your project's root directory.

What does SEO require?

The latest release requires PHP 8.3+ and Laravel 13.

Can I set the tags from a Blade view?

Yes. Every tag has a directive, such as @seoTitle or @seoImage, and a child view runs before its layout, so @seo in the layout prints what the view set.

Can I add my own meta tags?

Yes. Extend SingleElement or MultipleElement and add the class to the elements option of the configuration; it renders with the others and gets its own directive.

Does it work with Laravel Octane and queues?

Yes. Each request and each queued job starts with a fresh set of tags.

Is SEO free to use?

Yes. SEO is open source under the MIT license, so you can use it in personal and commercial projects.

Where can I find the SEO documentation?

Read the SEO documentation for setup, configuration, and usage examples.

How do I report a bug or contribute to SEO?

Open an issue or a pull request on GitHub, or ask in the Pharaonic Discord.

Ready to dig in?

Read the full documentation for installation, configuration, every element, Open Graph and Twitter cards, Eloquent models, Blade directives and custom elements.