A Laravel package to fetch all metadata of a webpage.
-
Add Service Provider Open
config/app.php
and addMobiosolutions\Metatags\Providers\MetatagsProvider::class,
to the end ofproviders
array:'providers' => array( .... Mobiosolutions\Metatags\Providers\MetatagsProvider::class, ),
Next under the
aliases
array:'aliases' => array( .... 'Metatags' => Mobiosolutions\Metatags\Facades\MetatagsFacade::class ),
- You need to install the DOM extension.
-
After following the above steps,
// Add to your controller to get all metatags data use Metatags; $metadata = Metatags::get("https://example.com/"); print_r($metadata);
Get only OG ( Open Graph ) Metatages data
$getOGTags = true; $metadata = Metatags::get("https://example.com/",$getOGTags); OR $metadata = Metatags::get("https://example.com/",true); print_r($metadata);