m2collective / laravel-head-markup
A package for editing basic website metadata.
Package info
github.com/m2collective/laravel-head-markup
pkg:composer/m2collective/laravel-head-markup
Requires
- php: ^8.3
- laravel/framework: ^13.0
This package is not auto-updated.
Last update: 2026-07-28 06:59:35 UTC
README
A package for editing basic website metadata.
Installation
You can install the package via composer:
composer require m2collective/laravel-head-markup
The package will automatically register itself.
Commands
Publishing the configuration file:
php artisan m2collective:head-markup:publish-config
Publishing HTML views:
php artisan m2collective:head-markup:publish-views
Usage
After installing the package, you can edit the basic metadata of your website.
Dependency injection
An example of using a package with the dependency injection:
use M2Collective\HeadMarkup\HeadMarkup; final class Example { /** * @var HeadMarkup */ protected HeadMarkup $headMakeup; /** * @param HeadMarkup $headMarkup */ public function __construct( HeadMarkup $headMarkup ) { $this->headMarkup = $headMarkup; } /** * @return mixed */ public function head(): mixed { $this->headMarkup ->setViewport('width=device-width, initial-scale=1') ->setCharset('utf-8') ->setTitle('Title') ->setDescription('Page Description') ->setKeywords('Keywords of the page') ->setRobots('index, follow') ->setAuthor('M2Collective') ->setCopyright('M2Collective') ->setCanonical(null) ->setPrev(null) ->setNext(null) } }
Facades
An example of using a package with the facades:
use M2Collective\HeadMarkup\Facades\HeadMarkup; final class Example { /** * @return mixed */ public function isDevice(): mixed { HeadMarkup::setViewport('width=device-width, initial-scale=1') ->setCharset('utf-8') ->setTitle('Title') ->setDescription('Page Description') ->setKeywords('Keywords of the page') ->setRobots('index, follow') ->setAuthor('M2Collective') ->setCopyright('M2Collective') ->setCanonical(null) ->setPrev(null) ->setNext(null) } }
Blade
An example of using a package with the blade:
<!DOCTYPE html> <html lang="en"> <head> <x-head-markup::viewport/> <x-head-markup::charset/> <x-head-markup::title/> <x-head-markup::description/> <x-head-markup::keywords/> <x-head-markup::robots/> <x-head-markup::author/> <x-head-markup::copyright/> <x-head-markup::canonical/> <x-head-markup::prev/> <x-head-markup::next/> </head> <body> </body> </html>
License
The MIT License (MIT). Please see the License file for more information.