areia-lab / laravel-seo-solution
SEO management package with Tailwind UI backend, OpenGraph & Twitter, and Blade helpers.
Installs: 21
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Language:Blade
pkg:composer/areia-lab/laravel-seo-solution
Requires
- php: ^8.1
- illuminate/support: ^9.0|^10.0|^11.0|^12.0
README
A modern Laravel SEO management package with:
- 📊 Tailwind UI backend for managing SEO meta data
- 🌐 OpenGraph & Twitter Card support out of the box
- ⚡ Blade helpers for easy rendering in views
📖 Documentation: Complete Guide to Laravel SEO Solution
🚀 Requirements
- PHP 8.0+
- Laravel 9.x / 10.x / 11.x / 12.x
- Database supported by Laravel (MySQL, PostgreSQL, SQLite, etc.)
- Node & NPM (if you want to customize/publish Tailwind UI)
📦 Installation
- Require the package:
composer require areia-lab/laravel-seo-solution
- Publish config & migrate:
php artisan vendor:publish --tag=seo-config php artisan vendor:publish --tag=seo-migrations php artisan migrate
- Publish views:
php artisan vendor:publish --tag=seo-views
⚙️ Configuration
The config file config/seo.php contains:
return [ 'route' => [ 'prefix' => env('SEO_PANEL_PREFIX', 'admin/seo'), 'middleware' => ['web'], ], 'disk' => env('SEO_DISK', 'public'), 'defaults' => [ 'title_suffix' => '', ], 'cache' => false, 'panel' => [ 'title_prefix' => 'Areia Lab SEO' ], ];
- Change
prefixormiddlewareas needed. - Run
php artisan storage:linkso uploaded OG/Twitter images are accessible.
🖥️ Admin Panel
Manage SEO meta records via:
/admin/seo
Features:
- Types:
global,page,model - Meta:
title,description,keywords,author,robots,canonical - OpenGraph:
title,description,type,image - Twitter:
title,description,card,image
📝 Usage in Blade
Place directives inside your layout <head> section.
Remove <title> (tag) or <title>{{ config('app.name', 'Laravel') }}</title> (this line) from your layout<head> section.
1. Global
@seoGlobal
or:
{!! app('seo')->global()->render() !!}
2. Page-specific
@seoAutoPage @seoPage('contact') // Using Route Name. e.g. "->name('contact')" # or @seoPage('contact-us') // Using URL Slug. e.g. "/contact-us"
or:
{!! app('seo')->forPage('contact')->render() !!} # or {!! app('seo')->forPage('contact-us')->render() !!}
3. Model-based (e.g. Blog Post)
@php $post = Post::first(); @endphp @seoModel($post)
or:
@php $post = Post::first(); @endphp {!! app('seo')->forModel($post)->render() !!}
✅ All Together in Layout
<head> @seoGlobal @seoAutoPage // This blade derivative is recommaded # or @isset($pageKey) @seoPage($pageKey) // Pass Data from blade. If Data changed from pannel it may not work. you need to fix statically @endisset # or @seoPage(Route::currentRouteName()) // it may not work if Route name means "->name('something')" not define or not match # or @seoPage(request()->path()) // it may not work if Route Uri "Route::get('something')" not match @isset($post) @seoModel($post) @endisset </head>
🔗 Examples
✅ Layout Example
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>@yield('title', 'My Website')</title> {{-- Inject SEO --}} @seoGlobal @seoAutoPage @isset($pageKey) @seoPage($pageKey) @endisset @isset($seoModel) @seoModel($seoModel) @endisset </head> <body> @yield('content') </body> </html>
✅ Page Example 1
['pageKey' => request()->path() ?? (Route::currentRouteName() ?? '/')] # or @extends('layouts.app') @section('title', 'Contact Us') @section('content') <h2>Contact Us</h2> <p>Feel free to reach out!</p> @endsection @push('head') @seoPage('contact') @endpush
✅ Page Example 2
Inside Layout
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>@yield('title', 'My Website')</title> <!-- Render SEO meta from pushed content --> @stack('head') </head> <body> @yield('content') </body> </html>
@extends('layouts.app') @section('title', 'Contact Us') @section('content') <h2>Contact Us</h2> <p>Feel free to reach out!</p> @endsection @push('head') @seoPage('contact') @endpush # or @push('head') @seoPage('/contact-us') @endpush
✅ Model Example
- First enable from config
'menu' => [ 'model' => true, // Hide model management by default ]
# inside your all seo able model you need to add 'HasSeoMeta' Trait # It require for getting only seo free model instance # In your 'Blog, Service, Product, Post' model jus add use AreiaLab\LaravelSeoSolution\Traits\HasSeoMeta; use HasSeoMeta;
@extends('layouts.app') @section('title', $post->title) @section('content') <h2>{{ $post->title }}</h2> <p>{{ $post->body }}</p> @endsection @push('head') @seoModel($post) @endpush
✅ For Production or Host inside (Cpanel, AWS or Other)
php artisan vendor:publish --tag=seo-views
npm install npm run build
Go To <views\areia\seo\layouts\app.blade.php>
# remove this line from `<head>` @vite(['resources/css/app.css', 'resources/js/app.js']) # Add <!-- Styles / Scripts --> <link rel="stylesheet" href="{{ asset('build/assets/{Your Generated CSS File Name}.css') }}"> <script src="{{ asset('build/assets/{Your Generated JS File Name}.js') }}" defer></script>
🌱 Seeder
Seed default SEO meta:
php artisan db:seed --class="AreiaLab\LaravelSeoSolution\Database\Seeders\SeoMetaSeeder"
📖 License
MIT License – Use freely in personal & commercial projects.
