A Laravel package to fetch webpage metadata ( Open Graph | Twitter | Facebook | Article )
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
README.md
composer.json
composer.lock

README.md

Metatags

A Laravel package to fetch all metadata of a webpage.

Installation

Perform the following operations in order to use this package

  • Run composer require "mobiosolutions/metatags" in your terminal

  • Add Service Provider Open config/app.php and add mobiosolutions\metatags\Providers\MetatagsProvider::class, to the end of providers array:

    'providers' => array(
        ....
        mobiosolutions\metatags\Providers\MetatagsProvider::class,
    ),
    

    Next under the aliases array:

    'aliases' => array(
        ....
        'Metatags' => mobiosolutions\metatags\Facades\MetatagsFacade::class
    ),
    

Requirements

  • You need to install the DOM extension.

How to use

  • 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);