SeoMunk is organized into independent modules.
Currently, the package provides:
- Meta — HTML metadata and social sharing metadata
- JSON — JSON-LD structured data and Schema.org support
Both modules are accessed through the main SeoMunk facade.
use SeoMunk\SeoMunk\Facades\SeoMunk;The Meta module is responsible for generating the metadata placed inside the <head> of a page.
Include the Meta component in your application's layout:
<x-meta-head />The component renders the metadata currently registered with SeoMunk.
Metadata can be explicitly defined using the SeoMunk facade:
use SeoMunk\SeoMunk\Facades\SeoMunk;
SeoMunk::meta()
->title('About Us')
->description('Learn more about our company.')
->canonical(url('/about'));Metadata methods are chainable.
For example:
SeoMunk::meta()
->title('My Product')
->description('A description of my product.')
->image(asset('images/product.jpg'))
->canonical(url('/products/my-product'))
->ogType('product')
->twitterCard('summary_large_image');The Meta module currently supports:
titledescriptioncanonicalrobotsimageauthorogTypetwitterCardsiteNameurl
Example:
SeoMunk::meta()
->title('My Page')
->description('My page description.')
->robots('index, follow')
->author('Jon Mierke')
->image(asset('images/og-image.jpg'))
->ogType('website')
->twitterCard('summary_large_image');SeoMunk can automatically generate metadata from Eloquent models.
Models can implement seoMetaDefaults():
public function seoMetaDefaults(): array
{
return [
'title' => $this->name,
'description' => $this->description,
'image' => $this->image,
'url' => route('products.show', $this),
];
}SeoMunk can then use the model as a source of default metadata.
Models may optionally use the HasSeoMeta concern to provide editable SEO metadata.
use SeoMunk\SeoMunk\Modules\Meta\Concerns\HasSeoMeta;
class Product extends Model
{
use HasSeoMeta;
}This allows stored SEO metadata to override model-derived defaults.
SeoMunk is designed around a layered metadata system.
In general, values are resolved from lower-priority defaults toward higher-priority overrides:
Configuration defaults
↓
Model-derived defaults
↓
Stored model SEO metadata
↓
Explicit SeoMunk::meta() values
The most specific value wins.
This allows an application to have automatic SEO metadata while still providing complete control over individual pages.
Add the component to your application's main layout:
<head>
<x-meta-head />
{{-- Other head elements --}}
</head>The component is intentionally responsible only for rendering the resolved metadata.
It does not need to know whether the metadata came from:
- configuration
- a model
- a database record
- a controller
- a route
- explicit
SeoMunk::meta()calls
The JSON module provides a fluent API for generating JSON-LD structured data.
Include the JSON-LD component in your layout:
<x-json-head />The component renders all schemas registered during the current request.
A generic Schema.org object can be registered using schema():
use SeoMunk\SeoMunk\Facades\SeoMunk;
SeoMunk::schema()->schema([
'@context' => 'https://schema.org',
'@type' => 'WebPage',
'name' => 'About Us',
]);This allows any valid Schema.org structure to be added without SeoMunk needing a dedicated schema type.
SeoMunk also provides convenience methods for common schema types.
For example:
SeoMunk::schema()->withFAQ([
[
'question' => 'What is SeoMunk?',
'answer' => 'SeoMunk is a Laravel package for SEO and AI Search Optimization.',
],
[
'question' => 'Does SeoMunk support JSON-LD?',
'answer' => 'Yes.',
],
]);Multiple schema types can be combined:
SeoMunk::schema()
->withProduct($product)
->withFAQ($faqs)
->withReviews($reviews)
->withBreadcrumb($breadcrumbs);All registered schemas are rendered by:
<x-json-head />SeoMunk provides withRawJson() for JSON-LD that doesn't have a dedicated convenience method.
SeoMunk::schema()->withRawJson($json);For example:
SeoMunk::schema()->withRawJson('
{
"@context": "https://schema.org",
"@type": "WebPage",
"name": "About Us"
}
');Raw JSON is decoded and normalized into SeoMunk's internal schema representation before rendering.
This provides an escape hatch for custom or uncommon Schema.org types.
JSON-LD schemas can also be generated automatically from Eloquent models.
Models can expose a geoProfile() method containing information that SeoMunk can use to determine which schemas should be generated.
For example:
public function geoProfile(): array
{
return [
'product' => [
// Product schema data
],
'faqs' => [
[
'question' => 'What is this product?',
'answer' => '...',
],
],
'reviews' => [
// Review data
],
'breadcrumb' => [
// Breadcrumb data
],
];
}Automatic schema generation is handled separately from rendering.
SeoMunk's automatic schema builder reads the model and registers the appropriate schemas with the schema manager.
This means models are one possible source of schemas, rather than being a requirement for using the JSON-LD system.
SeoMunk supports both automatic and explicit usage.
A model can provide SEO and schema information:
$product->seoMetaDefaults();
$product->geoProfile();SeoMunk can use these methods to build metadata and structured data automatically.
Applications can define everything manually:
SeoMunk::meta()
->title('About Us')
->description('Learn about our company.');
SeoMunk::schema()
->schema([
'@context' => 'https://schema.org',
'@type' => 'AboutPage',
'name' => 'About Us',
]);Automatic values can be used as defaults while explicit values override them:
SeoMunk::meta()
->from($product)
->title('Custom Product Title');
SeoMunk::schema()
->withProduct($product)
->withFAQ($faqs);This is one of the core design principles of SeoMunk: automation should be convenient, not restrictive.
SeoMunk currently provides two primary head components.
<x-meta-head />Responsible for rendering:
<title><meta name="description"><meta name="robots">- canonical URLs
- Open Graph tags
- Twitter/X card tags
- other metadata managed by the Meta module
<x-json-head />Responsible for rendering:
<script type="application/ld+json">
...
</script>blocks generated by the JSON-LD module.
A typical layout may therefore contain:
<head>
<x-meta-head />
<x-json-head />
</head>SeoMunk is designed around independent modules with a common philosophy:
Build data first. Render it separately.
The current architecture is roughly:
SeoMunk
│
├── Meta
│ ├── MetaManager
│ ├── MetaData
│ ├── BuildAutomaticMeta
│ └── HasSeoMeta
│
└── JSON
└── Schema
├── SchemaManager
├── SchemaBuilder
├── BuildAutomaticSchema
└── SchemaTypes
├── Product
├── FAQ
├── Review
├── Breadcrumb
└── Organization
The main facade provides access to the modules:
SeoMunk::meta();
SeoMunk::schema();This keeps the public API simple while allowing each module to remain independently organized.
SeoMunk is intentionally designed to avoid requiring a specific application architecture.
SEO data can come from:
- Eloquent models
- database records
- controllers
- routes
- configuration
- application services
- manually defined arrays
- raw JSON-LD
The package should not require applications to structure their models in a specific way just to use SeoMunk.
Automatic functionality is provided as a convenience, while manual APIs remain available when developers need complete control.
SeoMunk's configuration is stored in:
config/seomunk.php
Publish it with:
php artisan vendor:publish --tag=seomunk-configConfiguration is organized by module.
For example:
config('seomunk.meta');and:
config('seomunk.schema');Module-specific configuration will continue to evolve as SeoMunk develops.
SeoMunk is currently in early development.
The package architecture is being actively developed and the public API may change before the first stable release.
Current focus areas include:
- Meta management
- JSON-LD schema generation
- Automatic model-based SEO
- Automatic model-based structured data
- Additional Schema.org types
- Route-level SEO configuration
- More flexible page detection
- AIO/GEO functionality
- SEO analysis and scoring
Contributions, ideas, bug reports, and architectural feedback are welcome.
SeoMunk is open-source software licensed under the MIT License.