PHPackages                             foodieneers/laravel-seo - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. foodieneers/laravel-seo

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

foodieneers/laravel-seo
=======================

A package to handle the SEO in any Laravel application, big or small.

v1.6.0(1mo ago)033↓50%MITPHPPHP ^8.2

Since Mar 1Pushed 1mo agoCompare

[ Source](https://github.com/foodieneers/laravel-seo)[ Packagist](https://packagist.org/packages/foodieneers/laravel-seo)[ Docs](https://github.com/foodieneers/laravel-seo)[ RSS](/packages/foodieneers-laravel-seo/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (14)Versions (15)Used By (0)

[![laravel-seo](https://github.com/Foodieneers/laravel-seo/raw/main/docs/images/seo.jpg)](https://github.com/Foodieneers/laravel-seo/blob/main/docs/images/seo.jpg)

Never worry about SEO in Laravel again!
=======================================

[](#never-worry-about-seo-in-laravel-again)

Currently there aren't that many SEO-packages for Laravel and the available ones are quite complex to set up and very decoupled from the database. They only provided you with helpers to generate the tags, but you still had to use those helpers: nothing was generated automatically and they almost do not work out of the box.

This package generates **valid and useful meta tags straight out-of-the-box**, with limited initial configuration, while still providing a simple, but powerful API to work with. It can generate:

1. Title tag (with sitewide suffix)
2. Meta tags (author, description, image, robots, etc.)
3. OpenGraph Tags (Facebook, LinkedIn, etc.)
4. Twitter Tags
5. Structured data (Article, Breadcrumbs, FAQPage, or any custom schema)
6. Favicon
7. Robots tag
8. Alternates links tag

If you're familiar with Spatie's media-library package, this package works in almost the same way, but then only for SEO. I'm sure it will be very helpful for you, as it's usually best for a website to have attention for SEO right from the beginning.

Here are a few examples of what you can do:

```
$post = Post::find(1);

$post->seo->update([
   'title' => 'My great post',
   'description' => 'This great post will enhance your live.',
]);
```

It will render the SEO tags directly on your page:

```

    {!! seo()->for($post) !!}

    {{-- No need to separately render a  tag or any other meta tags! --}}

```

It even allows you to **dynamically retrieve SEO data from your model**, without having to save it manually to the SEO model. The below code will require zero additional work from you or from your users:

```
class Post extends Model
{
    use HasSEO;

    public function getDynamicSEOData(): SEOData
    {
        $pathToFeaturedImageRelativeToPublicPath = // ..;

        // Override only the properties you want:
        return new SEOData(
            title: $this->title,
            description: $this->excerpt,
            image: $pathToFeaturedImageRelativeToPublicPath,
        );
    }
}
```

Installation
------------

[](#installation)

Run the following command to install the package:

```
composer require Foodieneers/laravel-seo
```

Publish the migration and configuration file:

```
php artisan vendor:publish --tag="seo-migrations"
php artisan vendor:publish --tag="seo-config"
```

Next, go to the newly published config file in `config/seo.php` and make sure that all the settings are correct. Those settings are all sort of default values:

```
