PHPackages                             elegantly/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. elegantly/laravel-seo

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

elegantly/laravel-seo
=====================

An Elegant &amp; flexible SEO tag builder for Laravel

v1.3.1(3mo ago)122.9k↓25%1[2 PRs](https://github.com/ElegantEngineeringTech/laravel-seo/pulls)MITPHPPHP ^8.2CI passing

Since Aug 23Pushed 1mo ago1 watchersCompare

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

READMEChangelog (10)Dependencies (12)Versions (22)Used By (0)

An Elegant &amp; Flexible SEO Tag Builder for Laravel
=====================================================

[](#an-elegant--flexible-seo-tag-builder-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/8e96fb8b7ff717f40047755d7097fdd5b3eb85bd9ae51b7f75ad3aba8a9181c4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656c6567616e746c792f6c61726176656c2d73656f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/elegantly/laravel-seo)[![GitHub Tests Action Status](https://camo.githubusercontent.com/2eba625c31c52fdf9322eb4c5f722120cfde04031439fbc948ab4f6acbe3dccb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f456c6567616e74456e67696e656572696e67546563682f6c61726176656c2d73656f2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/ElegantEngineeringTech/laravel-seo/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/8f34a1c37b37e2b24b0558393b0fc6250da022328803b0905108570296817113/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f456c6567616e74456e67696e656572696e67546563682f6c61726176656c2d73656f2f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/ElegantEngineeringTech/laravel-seo/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/8efbf2942b90bffc87508b407f41e33964585ef00b1db5115eeba7c62feb1e10/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f656c6567616e746c792f6c61726176656c2d73656f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/elegantly/laravel-seo)

[![laravel-seo](https://repository-images.githubusercontent.com/845966143/6ff7437c-852d-41eb-8b2f-927551506a13)](https://repository-images.githubusercontent.com/845966143/6ff7437c-852d-41eb-8b2f-927551506a13)

Introduction
------------

[](#introduction)

`laravel-seo` is a flexible and powerful package for managing SEO tags in Laravel applications.

With this package, you can easily handle:

- Standard HTML tags like `` and ``
- Localization with alternate tags ([Google SEO Localization](https://developers.google.com/search/docs/specialty/international/localized-versions))
- [Open Graph tags](https://ogp.me/) with structured properties, arrays, and object types
- [Twitter (X) tags](https://developer.x.com/en/docs/x-for-websites/cards/overview/abouts-cards)
- [Structured data (JSON-LD)](https://developers.google.com/search/docs/appearance/structured-data/intro-structured-data)

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

[](#installation)

You can install the package via Composer:

```
composer require elegantly/laravel-seo
```

Next, publish the config file:

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

### Config File Overview

[](#config-file-overview)

The configuration file (`config/seo.php`) allows you to customize the default SEO behavior for your application. Here's a snippet with all available settings:

```
return [

    'defaults' => [
        /*
        |--------------------------------------------------------------------------
        | Default Title
        |--------------------------------------------------------------------------
        |
        | This is the default value used for , "og:title", "twitter:title"
        |
        */
        'title' => env('APP_NAME', 'Laravel'),

        /*
        |--------------------------------------------------------------------------
        | Default Description
        |--------------------------------------------------------------------------
        |
        | This is the default value used for ,
        | ,
        |
        */
        'description' => null,

        /*
        |--------------------------------------------------------------------------
        | Default Author
        |--------------------------------------------------------------------------
        |
        | This is the default value used for
        |
        */
        'author' => null,

        /*
        |--------------------------------------------------------------------------
        | Default Generator
        |--------------------------------------------------------------------------
        |
        | This is the default value used for
        |
        */
        'generator' => null,

        /*
        |--------------------------------------------------------------------------
        | Default Keywords
        |--------------------------------------------------------------------------
        |
        | This is the default value used for
        | Types supported: string or array of strings
        |
        */
        'keywords' => null,

        /*
        |--------------------------------------------------------------------------
        | Default Referrer
        |--------------------------------------------------------------------------
        |
        | This is the default value used for
        |
        */
        'referrer' => null,

        /*
        |--------------------------------------------------------------------------
        | Default Theme color
        |--------------------------------------------------------------------------
        |
        | This is the default value used for
        |
        */
        'theme-color' => null,

        /*
        |--------------------------------------------------------------------------
        | Default Color Scheme
        |--------------------------------------------------------------------------
        |
        | This is the default value used for
        |
        */
        'color-scheme' => null,

        /*
        |--------------------------------------------------------------------------
        | Default Image path
        |--------------------------------------------------------------------------
        |
        | This is the default value used for ,
        | You can use relative path like "/opengraph.png" or url like "https://example.com/opengraph.png"
        |
        */
        'image' => null,

        /*
        |--------------------------------------------------------------------------
        | Default Robots
        |--------------------------------------------------------------------------
        |
        | This is the default value used for
        | See Google documentation here: https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag?hl=fr#directives
        |
        */
        'robots' => 'max-snippet:-1,max-image-preview:large,max-video-preview:-1',

        /*
        |--------------------------------------------------------------------------
        | Default Sitemap path
        |--------------------------------------------------------------------------
        |
        | This is the default value used for
        | You can use relative path like "/sitemap.xml" or url like "https://example.com/sitemap.xml"
        |
        */
        'sitemap' => null,
    ],

    /**
     * @see https://ogp.me/
     */
    'opengraph' => [
        /*
        |--------------------------------------------------------------------------
        | Default Site Name
        |--------------------------------------------------------------------------
        |
        | This is the default value used for
        | If null: config('app.name') is used.
        |
        */
        'site_name' => null,

        /*
        |--------------------------------------------------------------------------
        | Default Determiner
        |--------------------------------------------------------------------------
        |
        | This is the default value used for
        | Possible values are: a, an, the, "", auto
        |
        */
        'determiner' => '',
    ],

    /**
     * @see https://developer.x.com/en/docs/x-for-websites/cards/overview/abouts-cards
     */
    'twitter' => [
        /*
        |--------------------------------------------------------------------------
        | Default Twitter username
        |--------------------------------------------------------------------------
        |
        | This is the default value used for
        | Example: @X
        |
        */
        'site' => null,
    ],

    /**
     * @see https://schema.org/WebPage
     */
    'schema' => [
        /*
        |--------------------------------------------------------------------------
        | Default WebPage schema
        |--------------------------------------------------------------------------
        |
        | This is the default value used for the schema WebPage
        | @see https://schema.org/WebPage for all available properties
        |
        */
        'webpage' => [],
    ],

];
```

Usage
-----

[](#usage)

### Displaying SEO Tags

[](#displaying-seo-tags)

You can easily render all SEO tags in your Blade views by calling the `seo()` helper function:

```

    {!! seo() !!}

```

This will render all the default tags, for example:

```
Home

    {
        "@context": "https://schema.org",
        "@type": "WebPage",
        "name": "Home",
        "url": "https://example.com"
    }

```

### Setting SEO Tags in Controllers

[](#setting-seo-tags-in-controllers)

You will typically want to define your SEO tags dynamically in your controllers. You can do this using either the `seo()` helper or the `SeoManager` facade:

```
namespace App\Http\Controllers;

use \Elegantly\Seo\Facades\SeoManager;
use Elegantly\Seo\Standard\Alternate;

class HomeController extends Controller
{
    public function __invoke()
    {
        // Using the helper
        seo()
            ->setTitle("Homepage")
            ->setImage(asset('images/opengraph.jpg'))
            ->setDescription("The homepage description")
            ->when(!App::isProduction(), fn($seo) => $seo->noIndex())
            ->setLocale("fr")
            ->setAlternates([
                new Alternate(
                    hreflang: "en",
                    href: route('home', ['locale' => "en"]),
                ),
                new Alternate(
                    hreflang: "fr",
                    href: route('home', ['locale' => "fr"]),
                ),
            ])
            ->setOpengraph(function(OpenGraph $opengraph){
                $opengraph->title = "Custom opengraph title";
                return $opengraph;
            });

        // Using the facade
        SeoManager::current()
            ->setTitle("Homepage")
            ->setDescription("The homepage description");
            // ...

        return view('home');
    }
}
```

Then, in your Blade view, just render the tags like this:

```

    {!! seo() !!}

```

### Advanced Usage

[](#advanced-usage)

For more complex SEO needs, you can instantiate and configure the `SeoManager` class directly. This gives you full control over every tag, including Open Graph, Twitter, JSON-LD, and custom schema tags.

```
use Elegantly\Seo\SeoManager;
use Elegantly\Seo\Standard\Standard;
use Elegantly\Seo\OpenGraph\OpenGraph;
use Elegantly\Seo\Twitter\Cards\Card;
use Elegantly\Seo\Schemas\Schema;
use Elegantly\Seo\SeoTags;

$seo = new SeoManager(
    standard: new Standard(/* ... */),
    opengraph: new OpenGraph(/* ... */),
    twitter: new Card(/* ... */),
    webpage: new WebPage(/* ... */),
    schemas: [/* ... */],
    customTags: new SeoTags(/* ... */)
);
```

Then, in your Blade view:

```

    {!! $seo !!}

```

Testing
-------

[](#testing)

To run the tests:

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for details on recent updates.

Contributing
------------

[](#contributing)

See [CONTRIBUTING](CONTRIBUTING.md) for guidelines on contributing to this project.

Security
--------

[](#security)

Please refer to our [security policy](../../security/policy) for reporting vulnerabilities.

Credits
-------

[](#credits)

- [Quentin Gabriele](https://github.com/QuentinGab)
- [All Contributors](../../contributors)

License
-------

[](#license)

This package is licensed under the [MIT License](LICENSE.md).

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance86

Actively maintained with recent releases

Popularity29

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 80.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~27 days

Recently: every ~124 days

Total

20

Last Release

107d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d769563728757858e249f266ac2555f28db5640124df92821ed17d93ee76fc7b?d=identicon)[QuentinGab](/maintainers/QuentinGab)

---

Top Contributors

[![QuentinGab](https://avatars.githubusercontent.com/u/40128136?v=4)](https://github.com/QuentinGab "QuentinGab (58 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (9 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (5 commits)")

---

Tags

laravellaravel-packagelaravel-seoopengraphphpschema-orgseolaravelseoopengraphlaravel-seoElegantly

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/elegantly-laravel-seo/health.svg)

```
[![Health](https://phpackages.com/badges/elegantly-laravel-seo/health.svg)](https://phpackages.com/packages/elegantly-laravel-seo)
```

###  Alternatives

[spatie/laravel-data

Create unified resources and data transfer objects

1.7k28.9M627](/packages/spatie-laravel-data)[ralphjsmit/laravel-seo

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

841433.3k21](/packages/ralphjsmit-laravel-seo)[honeystone/laravel-seo

SEO metadata and JSON-LD package for Laravel.

34744.1k](/packages/honeystone-laravel-seo)[hirethunk/verbs

An event sourcing package that feels nice.

513162.9k6](/packages/hirethunk-verbs)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

123544.7k](/packages/worksome-exchange)[ralphjsmit/livewire-urls

Get the previous and current url in Livewire.

82270.3k4](/packages/ralphjsmit-livewire-urls)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
