A Laravel package to fetch Open Graph metadata of a website.
Perform the following operations in order to use this package
- Run
composer require "shweshi/opengraph"
in your terminal
If you do not run Laravel 5.5 (or higher), then add the service provider in config/app.php:
-
Add Service Provider Open
config/app.php
and addshweshi\OpenGraph\Providers\OpenGraphProvider::class,
to the end ofproviders
array:'providers' => array( .... shweshi\OpenGraph\Providers\OpenGraphProvider::class, ),
Next under the
aliases
array:'aliases' => array( .... 'OpenGraph' => shweshi\OpenGraph\Facades\OpenGraphFacade::class ),
If you do run the package on Laravel 5.5+, package auto-discovery takes care of the magic of adding the service provider.
- You need to install the DOM extension.
-
After following the above steps,
use OpenGraph; $data = OpenGraph::fetch("https://unsplash.com/"); print_r($data);