Download the PHP package dominservice/laravel-theme-helper without Composer
On this page you can find all versions of the php package dominservice/laravel-theme-helper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dominservice/laravel-theme-helper
More information about dominservice/laravel-theme-helper
Files in dominservice/laravel-theme-helper
Package laravel-theme-helper
Short Description A small Laravel utility to manage everything you usually put into the and the closing of , plus a pragmatic Schema.org JSON‑LD generator.
License MIT
Homepage https://github.com/dominservice/laravel-theme-helper
Informations about the package laravel-theme-helper
Dominservice Laravel Theme Helper
A Laravel package for:
- SEO and meta management,
- asset registration and rendering,
- breadcrumb and hreflang support,
- JSON-LD / Schema.org generation,
- sitemap and
robots.txtgeneration helpers, - responsive image rendering with
picture/ AVIF / WebP / fallback support, - schema presets for common company and CMS pages,
- theme registry and active theme selection,
- public/admin theme context handling,
- asset resolution for
mix,vite, and static builds, - theme discovery through
theme.jsonmanifests.
It is designed to be the integration layer between your Laravel application and one or more frontend themes, while still providing the usual <head> and </body> helpers.
Table of contents
- Requirements
- Installation
- Quick start
- Theme system
- Contexts
- Theme config
- Theme discovery with
theme.json - Drivers
- Theme switching
- Structured data
- Multiple schema types on one page
- Schema collection API
- Schema presets
- Sitemap
- Robots.txt
- Responsive images
- API
- Blade integration
- Helpers
- Deployment notes
- Testing
- License
Requirements
- PHP 8.4+
- Laravel 13.32+
spatie/schema-org5.x
The current 4.x line targets DominPress and Laravel 13. Laravel 10–12 and PHP 8.1–8.3 remain available through the previous 3.x line. PHP 8.4 is required by spatie/schema-org 5.
- Optional:
mcamara/laravel-localization
Installation
Optional hreflang integration:
Publish config if you want to define themes globally:
This publishes:
config/theme-helper.php
Quick start
RobotsTxtBuilder::addGroup() wspiera także extras, więc można dodać dyrektywy specyficzne dla wybranych botów, np. Max-image-preview: large.
setIcons() wspiera także pełniejsze deklaracje favicon/PWA, m.in. apple_touch, icon, manifest, mask_icon, mask_color, ms_tile_image, ms_tile_color i theme_color.
MetaManager wspiera też dodatkowe tagi head przez setAuthor(), setGenerator(), addMeta() i setHttpEquiv().
Switch public theme dynamically:
Theme system
Contexts
The package supports theme contexts.
Typical usage:
adminpublic
Rules are application-defined, but a common setup is:
- admin always uses a fixed admin theme
- public can use one of many declared themes
Theme config
Published config structure:
Theme discovery with theme.json
The package can discover themes from one or more directories. This lets you keep your application-defined themes in config while also supporting uploaded or shipped themes described by a manifest.
Example config:
Example theme.json:
If a theme key already exists in config, config has priority over discovered manifests. This makes discovery safe for local overrides.
Drivers
Supported asset drivers:
staticmixvite
Theme switching
Structured data
Multiple schema types on one page
Google supports multiple structured data items on the same page when they describe user-visible content on that page. This is useful for pages that need more than one schema type at once, for example:
OrganizationWebSiteWebPageBreadcrumbListProductServiceFAQPage
This package supports that pattern through @graph.
Simple example:
Schema collection API
This lets you output one graph that contains separate entities for organization data, product data, services, breadcrumbs or page-level metadata.
Schema presets
For common business pages you often want a repeatable graph instead of building every entity manually.
Available preset keys:
organizationwebsitehome_pageweb_pageservice_pageproduct_pagefaq_page
Example:
Sitemap
The package includes a builder for XML sitemaps. It supports:
- standard
urlset, sitemapindex,- image sitemap extensions,
- alternate locale URLs through
xhtml:link, - configurable default
changefreqandpriority.
Example:
For sitemap indexes:
Robots.txt
The package also includes a builder for robots.txt.
Example:
Responsive images
The package includes a small renderer for SEO-friendly responsive images with modern formats.
Example using explicit <source> nodes:
Or using a simpler format map:
API
Main facade methods:
Blade integration
Helpers
Available helpers:
theme_structured_data(array $data, array $options = [])theme_structured_graph(array $schemas, array $options = [])theme_sitemap()theme_robots()theme_schema_preset(string $preset, array $data = [])theme_picture(array $sources, array $imgAttributes = [], array $pictureAttributes = [])theme_current_theme(string $context = 'public')theme_current_layout(string $context = 'public')theme_use(string $themeKey, ?string $context = null)
Deployment notes
Theme definitions can now also carry:
build_config_pathmanifest_pathhot_file_pathdeploy_targetsource_pathpreview_imagesettings
This makes the package a good base for future theme upload, import/export and theme management panels without forcing a specific storage model today.
Testing
Run package tests:
License
MIT
All versions of laravel-theme-helper with dependencies
ext-json Version *
laravel/framework Version ^13.32
spatie/schema-org Version ^5.0.1