Download the PHP package tdonselaar/opengraph without Composer
On this page you can find all versions of the php package tdonselaar/opengraph. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tdonselaar/opengraph
More information about tdonselaar/opengraph
Files in tdonselaar/opengraph
Package opengraph
Short Description A Laravel package to fetch website Open Graph metadata.
License MIT
Informations about the package opengraph
OpenGraph is a laravel package to fetch Open Graph metadata of a website/link.
Features
-
Easily fetch metadata of a URL. Laravel OpenGraph fetches all the metadata of a URL.
-
Supports language-specific metadata. Laravel OpenGraph can fetch metadata in a specific language if webpage supports.
-
Supports twitter metadata. Laravel OpenGraph supports twitter OG data too.
- Verify image URL. Laravel OpenGraph verifies that the image URL in the image metadata is valid or not.
Demo
How to use Laravel OpenGraph
An article can be found on the medium blog: https://hackernoon.com/how-to-fetch-open-graph-metadata-in-laravel-2d5d674904d7
Documentation
Installation
Perform the following operations in order to use this package
- Install via composer
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:Next under the
aliases
array:
If you do run the package on Laravel 5.5+, package auto-discovery takes care of the magic of adding the service provider.
Requirements
- You need to install the DOM extension.
How to use
-
After following the above steps,
this will give you an array like this...
You can also pass an optional parameter either true or false along with URL. When set false it will only fetch basic metadata and in case of true it will fetch all the other optional metadata as well like audio, video, music and twitter metatags as well.
this will give you an array like this...
To fetch the metadata in a specific language you can pass the language as the third argument, this value will be used as the Accept-Language header.
You can also pass additional Libxml parameters as the fourth argument ($options) https://www.php.net/manual/en/libxml.constants.php. Default options are set to suppress the reporting of errors and warnings
You can use the fifth parameter to set the user-agent ($userAgent) of the request. The default is 'Curl'.
Exception Handling
The fetch() method, returns a FetchException with aditional data at failure.
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CODE OF CONDUCT for details.
License
The MIT License (MIT). Please see License File for more information.
Happy coding!
All versions of opengraph with dependencies
ext-dom Version *
ext-libxml Version *
ext-curl Version *
ext-json Version *