/laravel-seo-manager

URL based meta tag management

Primary LanguagePHPMIT LicenseMIT

Laravel SEO Manager

Laravel SEO Manager

Latest Version on Packagist Total Downloads Code Quality Code Coverage GitHub Tests Action Status PHPStan

This package provides simple functionality to manage SEO tags based on URL path within your Laravel application.

You can put the URL path available within your app with the JSON of tags you want to get in the view under the specified path. The wildcard * notation is available as well. You will get the manager variable with tags for each view as a Collection instance by default. The model to use by the package and variable name is customizable in the config file.

The package requires PHP ^8.x and Laravel ^8.71 or ^9.0.

#StandWithUkraine

SWUbanner

Installation

Install the package using composer:

composer require michael-rubel/laravel-seo-manager

Publish the migration:

php artisan vendor:publish --tag="seo-manager-migrations"

Publish the config file:

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

Usage

After publishing the config and running migrations, you can apply URLs in the seo_tags table using following patterns:

  • /test-url/*
  • /test-url/my-target
  • /test-url/any-target/*

Wildcard * has a lower priority than explicit define.

  • Note: If you're going to override the model to use a different database structure, make sure your model implements SeoTagContract. The package uses two simple methods to get the database columns.

Contributing

If you see the way we can improve the package, you're free to open an issue or pull request.

Testing

composer test