PHP code example of pedroborges / meta-tags
1. Go to this page and download the library: Download pedroborges/meta-tags 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' );
pedroborges / meta-tags example snippets
use PedroBorges \MetaTags \MetaTags ;
$tags = new MetaTags;
$tags->title('My Awesome Site' );
$tags->meta('description' , 'My site description' );
$tags->link('canonical' , 'https://pedroborg.es' );
$tags->link('alternate' , [
'hreflang' => 'en' ,
'href' => 'https://en.pedroborg.es'
]);
$tags->og('title' , 'The title' );
$tags->og('type' , 'website' );
$tags->og('url' , 'https://pedroborg.es' );
$tags->og('image' , 'https://pedroborg.es/cover.jpg' );
$tags->twitter('card' , 'summary' );
$tags->twitter('site' , '@pedroborg_es' );
$tags->jsonld([
'@context' => 'http://schema.org' ,
'@type' : 'Person' ,
'name' : 'Pedro Borges'
]);
<html>
<head>
<meta charset="utf-8" >
<meta name="viewport" content="width=device-width, initial-scale=1" >
echo $tags->render()
echo $tags->render('title' )
echo $tags->render(['og' , 'twitter' , 'json-ld' ])
use PedroBorges \MetaTags \MetaTags ;
$tags = new MetaTags("\t" , ['meta' , 'title' , 'link' , 'og' , 'twitter' , 'json-ld' ]);