PHP code example of luisinder / social-metatags
1. Go to this page and download the library: Download luisinder/social-metatags 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/ */
luisinder / social-metatags example snippets
use Luisinder\SocialMetaTags as SMT;
echo SMT::metaTitle('My Article');
echo SMT::metaDescription('Short summary for search engines.');
// Twitter
echo SMT::meta_twCard('summary_large_image');
echo SMT::meta_twSite('mySite'); // @ prefix auto-added
echo SMT::meta_twTitle('My Article');
echo SMT::meta_twDescription('A longer description that will be truncated to 200 characters automatically.');
echo SMT::meta_twCreator('authorHandle');
echo SMT::meta_twImage('https://example.com/img/article-cover.jpg');
// Open Graph
echo SMT::meta_ogTitle('My Article');
echo SMT::meta_ogType('article');
echo SMT::meta_ogUrl('https://example.com/articles/my-article');
echo SMT::meta_ogImage('https://example.com/img/article-cover.jpg');
echo SMT::meta_ogDescription('Same description (or a custom one) for Open Graph.');
echo SMT::meta_ogSiteName('Example Site');
echo SMT::meta_ogPublishedTime('2025-08-10T09:30:00+00:00');