beebmx/og-reader

Read OG meta tags

dev-main 2021-11-18 04:23 UTC

This package is auto-updated.

Last update: 2024-04-18 10:07:54 UTC


README

Latest Version on Packagist Total Downloads

This packages helps you to detect and read Open Graphs tags in any html page.

Installation

You can install the package via composer:

composer require beebmx/og-reader

Usage

For validate a page with or without Open Graph tags:

use Beebmx\OgReader\ContentReader;

$reader = ContentReader::load('https://website.com');

$reader->meta()->hasOg();
$reader->meta()->notHasOg();

If you need all the meta tags in the page:

use Beebmx\OgReader\ContentReader;

$reader = ContentReader::load('https://website.com');

$reader->meta();

If you only need the Open Graph tags:

use Beebmx\OgReader\ContentReader;

$reader = ContentReader::load('https://website.com');

$reader->meta()->og();

Each tag can be access like an object:

$tag->property;
$tag->content;

If you need the tag representation as HTML just:

$tag->asHtml();

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.