PHP code example of lukaswhite / php-meta-tags-parser

1. Go to this page and download the library: Download lukaswhite/php-meta-tags-parser 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/ */

    

lukaswhite / php-meta-tags-parser example snippets


use Lukaswhite\MetaTagsParser\Parser;

$html = '<html><head>...</head></html>';

$parser = new Parser();
$result = $parser->parse($html);

$result->getTitle();
$result->getDescription();
$result->getKeywords();
$result->getUrl();
$result->getFacebookAppId();

$result->openGraph()->getSiteName();
$result->openGraph()->getType();
$result->openGraph()->getTitle();
$result->openGraph()->getDescription();
$result->openGraph()->getLocale();
$result->openGraph()->getImages(); // returns an array of URLs
$result->openGraph()->getLatitude();
$result->openGraph()->getLongitude();
$result->openGraph()->getAltitude();

$result->toArray(); // all of the extracted metadata

$feed->getType(); // Feed::RSS or Feed::ATOM
$feed->isRSS();
$feed->isAtom();
$feed->getUri();
$feed->getTitle();

$result->getFeeds(Feed::RSS);
// or
$result->getFeeds(Feed::ATOM);