PHP code example of sergeybruhin / page-meta
1. Go to this page and download the library: Download sergeybruhin/page-meta library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sergeybruhin / page-meta example snippets
$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();
// config/page-meta.php
return [
'globalSiteName' => 'Your Site Name',
];
$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',
]);
bash
php artisan vendor:publish --provider="SergeyBruhin\PageMeta\Providers\PageMetaServiceProvider" --tag="config"