Created by mrdulal
A comprehensive SEO toolkit for Laravel applications that provides meta tags, Open Graph, Twitter Cards, JSON-LD schema, canonical URLs, robots.txt generation, XML sitemaps, and SEO auditing capabilities.
- Meta Tags Management - Title, description, keywords, author, robots
- Open Graph Support - Complete Open Graph meta tags for social sharing
- Twitter Cards - Twitter Card meta tags for enhanced tweets
- JSON-LD Schema - Structured data markup for search engines
- Canonical URLs - Prevent duplicate content issues
- Robots.txt Generation - Automatic robots.txt file generation
- XML Sitemap - Dynamic XML sitemap generation
- SEO Audit Middleware - Real-time SEO issue detection
- SEO Dashboard - Optional admin dashboard for SEO management
- Blade Components - Easy-to-use Blade components for templates
- Artisan Commands - Command-line tools for SEO management
- Database Integration - Polymorphic SEO meta storage with HasSeo trait
- Livewire Support - Full Livewire compatibility with reactive components
- Filament Integration - Complete Filament admin panel integration
- Real-time Updates - Live SEO management with instant previews
- Mobile Responsive - Optimized for all device sizes
Use the interactive installation command to choose your preferred integration:
composer require laravel-seo-pro/seo-pro
php artisan seo:install
The installer will guide you through selecting your integration method:
- Blade Components Only - Lightweight, no additional dependencies
- Livewire Integration - Reactive components with real-time updates
- Filament Integration - Admin panel with advanced management
- Full Integration - Livewire + Filament + Blade components
You can also specify your preferred integration directly:
# Blade components only (lightweight)
php artisan seo:install --blade-only
# With Livewire integration
php artisan seo:install --livewire
# With Filament integration
php artisan seo:install --filament
# Skip creating example files
php artisan seo:install --no-examples
# Force installation without prompts
php artisan seo:install --force --livewire
If you prefer manual installation:
- Install the package via Composer:
composer require laravel-seo-pro/seo-pro
- Publish the configuration file:
php artisan vendor:publish --provider="LaravelSeoPro\SeoProServiceProvider" --tag="seo-config"
- Publish and run the migrations:
php artisan vendor:publish --provider="LaravelSeoPro\SeoProServiceProvider" --tag="seo-migrations"
php artisan migrate
- (Optional) Publish the Blade views:
php artisan vendor:publish --provider="LaravelSeoPro\SeoProServiceProvider" --tag="seo-views"
- (Optional) Install additional dependencies:
# For Livewire support
composer require livewire/livewire
# For Filament support
composer require filament/filament
The package configuration is located in config/seo.php
. You can customize:
- Feature toggles - Enable/disable specific SEO components
- Default values - Set default meta tags and social media data
- Open Graph settings - Configure Open Graph defaults
- Twitter Card settings - Configure Twitter Card defaults
- Robots.txt rules - Set up search engine directives
- Sitemap configuration - Configure XML sitemap generation
- SEO audit rules - Set up automated SEO analysis
// config/seo.php
return [
'features' => [
'meta_tags' => true,
'open_graph' => true,
'twitter_cards' => true,
'json_ld' => true,
'canonical_urls' => true,
'robots_meta' => true,
'robots_txt' => true,
'sitemap' => true,
'audit_middleware' => true,
'dashboard' => false,
],
'defaults' => [
'title' => 'My Website',
'description' => 'Welcome to my website',
'keywords' => 'website, laravel, php',
'author' => 'My Company',
'robots' => 'index, follow',
],
'open_graph' => [
'type' => 'website',
'site_name' => 'My Website',
'locale' => 'en_US',
],
'twitter' => [
'card' => 'summary_large_image',
'site' => '@mywebsite',
'creator' => '@mywebsite',
],
];
use LaravelSeoPro\Facades\Seo;
// Set basic meta tags
Seo::setTitle('My Page Title')
->setDescription('This is my page description')
->setKeywords('laravel, seo, php')
->setAuthor('John Doe');
// Set Open Graph data
Seo::setOpenGraph('og:title', 'My Page Title')
->setOpenGraph('og:description', 'This is my page description')
->setOpenGraph('og:image', 'https://example.com/image.jpg');
// Set Twitter Card data
Seo::setTwitterCard('twitter:card', 'summary_large_image')
->setTwitterCard('twitter:title', 'My Page Title');
// Set JSON-LD schema
Seo::setJsonLd([
'@context' => 'https://schema.org',
'@type' => 'Article',
'headline' => 'My Article Title',
'author' => [
'@type' => 'Person',
'name' => 'John Doe'
]
]);
Include the SEO components in your layout:
<!DOCTYPE html>
<html>
<head>
<x-seo.meta :model="$post" />
<x-seo.og :model="$post" />
<x-seo.twitter :model="$post" />
<x-seo.json-ld :model="$post" />
</head>
<body>
<!-- Your content -->
</body>
</html>
For dynamic SEO management with Livewire:
<!-- Full SEO Manager -->
<livewire:seo-manager :model="$post" />
<!-- Simple SEO Fields -->
<livewire:seo-fields :model="$post" />
The package automatically registers Filament resources for SEO management:
- SEO Meta Resource - Manage all SEO data through Filament admin panel
- Automatic Integration - Works with any model that uses the HasSeo trait
- Bulk Operations - Manage multiple SEO records at once
- Advanced Filtering - Filter and search SEO data efficiently
Add the HasSeo
trait to your models:
use LaravelSeoPro\Traits\HasSeo;
class Post extends Model
{
use HasSeo;
public function getSeoUrl()
{
return route('posts.show', $this);
}
}
Then manage SEO data for your models:
$post = Post::find(1);
// Update SEO meta
$post->updateSeoMeta([
'title' => 'My Post Title',
'description' => 'This is my post description',
'og_image' => 'https://example.com/post-image.jpg',
]);
// Load SEO data into the service
Seo::loadFromModel($post);
php artisan seo:generate-robots
php artisan seo:generate-sitemap
php artisan seo:attach "App\Models\Post"
php artisan seo:audit https://example.com
Add the SEO audit middleware to your routes:
Route::middleware(['seo.audit'])->group(function () {
// Your routes
});
The package automatically registers these routes:
/seo/robots.txt
- Dynamic robots.txt/seo/sitemap.xml
- Dynamic XML sitemap
Seo::addJsonLd([
'@type' => 'Organization',
'name' => 'My Company',
'url' => 'https://example.com',
'logo' => 'https://example.com/logo.png'
]);
Seo::addMeta('custom-tag', 'custom-value')
->addMeta('another-tag', 'another-value');
Add your models to the sitemap configuration:
// config/seo.php
'sitemap' => [
'models' => [
\App\Models\Post::class,
\App\Models\Page::class,
],
// ...
],
Run the test suite:
composer test
Please see CONTRIBUTING.md for details.
Please see CHANGELOG.md for more information on what has changed recently.
This project is licensed under the MIT License - see the LICENSE file for details.
Made with β€οΈ by the Laravel SEO Pro Team
β Star us on GitHub β’ π Read the docs β’ π¬ Join our Discord