mahdijd / seo-management
A modern SEO management package for Laravel with first-class Filament v4 support.
v1.0.0
2026-08-08 10:11 UTC
Requires
- php: ^8.2
- filament/filament: ^4.0
- laravel/framework: ^12.0
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.0
- livewire/livewire: ^3.0
- orchestra/testbench: ^10.0
- pestphp/pest: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
This package is not auto-updated.
Last update: 2026-08-08 16:20:38 UTC
README
A modern, developer-friendly SEO management package for Laravel applications with first-class support for Filament v4.
Features
- π― SEO for any Eloquent model β add a single trait and you're done
- πΊοΈ Route SEO β manage SEO for named routes without model backing
- β‘ Runtime overrides β dynamically override any SEO field per-request
- π Global defaults β application-wide fallback values for all SEO fields
- π§ Intelligent resolution β priority chain: Runtime β Model β Route β Global
- πΎ Aggressive caching β rendered HTML is cached; zero DB queries on cache hits
- π Automatic invalidation β cache is cleared automatically when data changes
- π¨ Filament v4 integration β
SeoManagerGroup,SeoRouteResource,SeoSettingsPage - π·οΈ Complete meta tag support β title, description, canonical, robots, Open Graph, Twitter Cards, JSON-LD
Requirements
| Dependency | Version |
|---|---|
| PHP | β₯ 8.2 |
| Laravel | 12.x |
| Filament | 4.x |
Filament 5 is not supported in v1.x.
Installation
composer require mahdijd/seo-management
Publish and migrate
# Publish config php artisan vendor:publish --tag=seo-config # Publish migrations php artisan vendor:publish --tag=seo-migrations # Run migrations php artisan migrate
Quick Start
1. Add SEO to a model
use Mahdijd\SeoManagement\Traits\HasSeo; class Post extends Model { use HasSeo; // Optional: provide dynamic fallback values public function getSeoFallback(): array { return [ 'title' => $this->title, 'description' => $this->excerpt, ]; } }
2. Render SEO tags in your Blade layout
<head> <meta charset="UTF-8"> <x-seo::tags :model="$post" /> </head>
3. Runtime overrides
<x-seo::tags title="Search results for: {{ $query }}" :cache="false" />
4. Cacheable runtime pages
<x-seo::tags :model="$product" cacheKey="product-detail-{{ $product->id }}" />
Facade Usage
use Mahdijd\SeoManagement\Facades\Seo; // Resolve SEO data for a model $seoData = Seo::forModel($post); // Resolve SEO for a named route $seoData = Seo::forRoute('home'); // Manually clear model SEO cache Seo::clearModel($post); // Manually clear route SEO cache Seo::clearRoute('home'); // Flush all SEO cache entries Seo::flushAll();
Filament Integration
Register the plugin in your panel provider:
use Mahdijd\SeoManagement\Filament\SeoPlugin; public function panel(Panel $panel): Panel { return $panel ->plugins([ SeoPlugin::make(), ]); }
Add SeoManagerGroup to any Filament resource form:
use Mahdijd\SeoManagement\Filament\Forms\SeoManagerGroup; public static function form(Form $form): Form { return $form->schema([ // ... your other fields ... SeoManagerGroup::make(), ]); }
Configuration
// config/seo.php return [ 'cache' => true, // Enable/disable SEO caching 'cache_store' => null, // Cache store (null = default) 'cache_ttl' => 86400, // Cache TTL in seconds (24h) 'default_robots' => 'index,follow', 'default_twitter_card' => 'summary_large_image', 'filament' => [ 'delete_empty_records' => false, // Delete seo_metadata when all fields null 'navigation_group' => 'SEO', // Filament sidebar group label ], ];
Artisan Commands
# Clear all SEO cache entries
php artisan seo:cache:clear
Architecture
The package follows a strict layered architecture:
Blade Component (<x-seo::tags />)
β
SeoManager
β
SeoResolver SeoRenderer SeoCacheManager
β
Repository Layer (SeoMetadataRepository, SeoRouteRepository, SeoSettingsRepository)
β
Database (seo_metadata, seo_routes, seo_settings)
Resolution priority (highest to lowest):
- Runtime overrides (Blade attributes /
resolve(array $runtime)) - Model SEO (
seo_metadatarecord +getSeoFallback()) - Route SEO (
seo_routesrecord) - Global defaults (
seo_settingsrecord)
Supported Metadata
| Category | Tags |
|---|---|
| Standard | <title>, description, canonical, robots, keywords |
| Open Graph | og:title, og:description, og:image, og:type, og:url, og:site_name |
| Twitter Cards | twitter:card, twitter:title, twitter:description, twitter:image |
| Structured Data | <script type="application/ld+json"> |
Testing
# Run all tests composer test # Run with coverage composer test:coverage # Static analysis composer analyse # Code style check composer lint:check
License
This package is open-sourced software licensed under the MIT license.
Changelog
See CHANGELOG.md for the full release history.