sergeybruhin/page-meta

Laravel Page Meta Package

Maintainers

Package info

github.com/sergeybruhin/page-meta

pkg:composer/sergeybruhin/page-meta

Statistics

Installs: 74

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.1 2026-04-10 14:09 UTC

This package is auto-updated.

Last update: 2026-04-10 14:13:31 UTC


README

Latest Version on Packagist Total Downloads

Basic and simple package to help you generate page meta inside your blade layout.

Installation

You can install the package via composer:

composer require sergeybruhin/page-meta

Head Meta

Generates standard HTML <head> meta tags: title, description, author, keywords, robots directives, and canonical URL.

Controller

$headMeta = PageMeta::headMeta(
    title: 'My Article',
    description: 'Short page description',
);

$headMeta->setTitle('My Article', ' | ')  // appends site name: "My Article | Site Name"
         ->setCanonical(route('blog.show', $post))
         ->setAuthor('Sergey Bruhin')
         ->setKeywords(['laravel', 'php', 'seo'])
         ->noIndex()
         ->noFollow();

Render

@include('page-meta::head-meta')

Template renders when $headMeta is set in the view.

Output

<title>My Article | Site Name</title>
<meta name="description" content="Short page description">
<meta name="author" content="Sergey Bruhin">
<meta name="keywords" content="laravel, php, seo">
<meta name="robots" content="noindex, nofollow">
<link rel="canonical" href="https://example.com/blog/my-article">

Available methods

Method Description
setTitle(string, ?string $separator) Page title. Pass a separator (e.g. ' | ') to append globalSiteName from config.
setDescription(string) Meta description.
setAuthor(string) Meta author.
setCanonical(string) Canonical URL. Only rendered when set.
setKeywords(string|array) Meta keywords.
setRobots(string) Raw robots string, e.g. 'noindex, nofollow'.
noIndex() Adds noindex to robots.
noFollow() Adds nofollow to robots.
noArchive() Adds noarchive to robots.
noSnippet() Adds nosnippet to robots.

Configuration

Publish the config to set your site name:

php artisan vendor:publish --provider="SergeyBruhin\PageMeta\Providers\PageMetaServiceProvider" --tag="config"
// config/page-meta.php
return [
    'globalSiteName' => 'Your Site Name',
];

Open Graph

Controller

$openGraph = PageMeta::openGraphArticle(
    route('home'),
    $page->name,
    $page->description,
    'Your site name',
);

$openGraph->addImage(
    'https://example.com/image/url.png',
    100,
    100,
    Image::TYPE_WEBP
);

$openGraph->addTags([
    'Some tag',
    'And',
    'Another Tag'
]);

$openGraph->addAuthors([
    'https://example.com/author/some-author',
    'https://example.com/author/another',
]);

Render

@include('page-meta::open-graph')

Template renders when $openGraph is set in the view.

Testing (Not yet 💁‍♂️)

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email sundaycreative@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.