SEO Manager Package for Laravel

This package will provide you an interface from where you can manage all your pages metadata separately and get dynamically changing content.

Photo by Merakist on Unsplash

Update:

Localization: https://medium.com/@karakhanyansa/localization-for-seo-manager-package-for-laravel-framework-6ac4aba7bbc0

Installation

You can install the package via composer:

composer require lionix/seo-manager
php artisan vendor:publish --provider="Lionix\SeoManager\SeoManagerServiceProvider"

Configurations

In config/seo-manager.php file you can do the following configurations:

return [
/**
* Database table name where your manager data will be stored
*/
'database' => [
'table' => 'seo_manager'
],
/**
* Path where your eloquent models are
*/
'models_path' => '',
/**
* Route from which your Dashboard will be available
*/
'route' => 'seo-manager',
/**
* Middleware array for dashboard
* to prevent unauthorized users visit the manager
*/
'middleware' => [
// 'auth',
],
/**
* Routes which shouldn't be imported to seo manager
*/
'except_routes' => [
'seo-manager',
'admin'
//
],
/**
* Columns which shouldn't be used ( in mapping )
*/
'except_columns' => [
// "created_at",
// "updated_at",
],
/**
* Set this parameter to true
* if you want to have "$metaData" variable
* shared between all views in "web" middleware group
*/
'shared_meta_data' => false
];

Usage

After visiting your dashboard URL you have to import your routes to start to manage them.

Let the fun begin!

Mapping

Example Usage

Via SeoManager Facade

use Lionix\SeoManager\Facades\SeoManager;
SeoManager::metaData();
array:13 [▼
"keywords" => "First Keyword, Second, Third"
"description" => "Test Description"
"title" => "Test Titile"
"url" => "http://example.com/users/1"
"author" => "Sergey Karakhanyan"
"title_dynamic" => "Test Titile - Custom Text - Test User Name "
"og:url" => "http://example.com/users/1"
"og:type" => "website"
"og:image:url" => "https://wallpaperbrowse.com/media/images/3848765-wallpaper-images-download.jpg"
"og:title" => "Test Titile - Custom Open Graph Text"
"og:locale" => "en_GB"
"og:site_name" => "Seo Manager Package"
"og:description" => "Open Graph Description"
]
SeoManager::metaData('og_data');
array:7 [▼
"og:url" => "http://example.com/users/1"
"og:type" => "website"
"og:image:url" => "https://wallpaperbrowse.com/media/images/3848765-wallpaper-images-download.jpg"
"og:title" => "Test Titile - Custom Open Graph Text"
"og:locale" => "en_GB"
"og:site_name" => "Seo Manager Package"
"og:description" => "Open Graph Description"
]

Via helper functions

metaData()

Via @Blade directives

You can use this blade directives in your view files to get metadata.

<meta property="keywords" content="First Keyword, Second, Third">
<meta property="description" content="Test Description">
<meta property="title" content="Test Titile">
<meta property="url" content="http://packages.loc/users/1">
<meta property="author" content="Sergey Karakhanyan">
<meta property="title_dynamic" content="Test Titile - Custom Text - Test User Name ">
<meta property="og:url" content="http://packages.loc/users/1">
<meta property="og:type" content="website">
<meta property="og:image:url" content="https://wallpaperbrowse.com/media/images/3848765-wallpaper-images-download.jpg">
<meta property="og:title" content="Test Titile - Custom Open Graph Text">
<meta property="og:locale" content="en_GB">
<meta property="og:site_name" content="Seo Manager Package">
<meta property="og:description" content="Open Graph Description">
<meta property="description" content="Test Description">
<meta property="og:image:url" content="{{ asset(metaOpenGraph('og:image:url')) }}">
@meta

Credits

CEO @ lionix

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store