beebmx / og-reader
Read OG meta tags
dev-main
2021-11-18 04:23 UTC
Requires
- php: ^8.0
- ext-dom: *
- ext-libxml: *
Requires (Dev)
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-12-18 11:52:50 UTC
README
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.