PHPackages                             fusonic/opengraph - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. fusonic/opengraph

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

fusonic/opengraph
=================

PHP library for consuming and publishing Open Graph resources.

v3.0.0(1y ago)104373.0k—2.6%38[1 issues](https://github.com/fusonic/opengraph/issues)3MITPHPPHP ^8.1

Since Jul 23Pushed 1y ago6 watchersCompare

[ Source](https://github.com/fusonic/opengraph)[ Packagist](https://packagist.org/packages/fusonic/opengraph)[ Docs](https://github.com/fusonic/opengraph)[ RSS](/packages/fusonic-opengraph/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (12)Versions (9)Used By (3)

fusonic/opengraph
=================

[](#fusonicopengraph)

[![GitHub Release](https://camo.githubusercontent.com/9ab9c6a7141ef64f3cd56e9bbd4f4651861c44200c27d8dfeb52339fc717853f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6675736f6e69632f6f70656e6772617068)](https://github.com/fusonic/opengraph/releases/latest)[![Packagist Downloads](https://camo.githubusercontent.com/8cda8849c852ec1f4e7cc350c8f992aa0caf172cc21fe39cf0de442f6ce0232a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6675736f6e69632f6f70656e67726170683f636f6c6f723d626c7565)](https://packagist.org/packages/fusonic/opengraph)[![Packagist License](https://camo.githubusercontent.com/7090feb561143acd1e3c28e928c32d9eb5232c803507dca0844b5b0771264167/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6675736f6e69632f6f70656e6772617068)](https://github.com/fusonic/opengraph/blob/master/LICENSE)[![GitHub Actions Workflow Status](https://camo.githubusercontent.com/70e38bf2f6b9bb3544fad140bf65148ed29c2dbee16d28983559e4c82c17e3fc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6675736f6e69632f6f70656e67726170682f746573742e796d6c3f6c6f676f3d676974687562266c6162656c3d5465737473)](https://github.com/fusonic/opengraph/actions/workflows/test.yml)

A simple library to read Open Graph data from the web and generate HTML code to publish your own Open Graph objects. A fallback mode enables you to read data from websites that do not implement the Open Graph protocol.

Using this library you can easily retrieve stuff like metadata, video information from YouTube or Vimeo or image information from Flickr without using site-specific APIs since they all implement the Open Graph protocol.

See [ogp.me](https://ogp.me) for information on the Open Graph protocol.

Requirements
------------

[](#requirements)

- PHP 8.1+
- [symfony/css-selector](https://github.com/symfony/css-selector)
- [symfony/dom-crawler](https://github.com/symfony/dom-crawler)
- [psr/http-client](https://github.com/php-fig/http-client)
- [psr/http-factory](https://github.com/php-fig/http-factory)
- and compatible implementation such as [symfony/http-client](https://github.com/symfony/http-client)

Installation
------------

[](#installation)

The most flexible installation method is using Composer:

```
composer require fusonic/opengraph
```

Install Composer and run the `install` command:

```
curl -s http://getcomposer.org/installer | php
php composer.phar install
```

Once installed, include `vendor/autoload.php` in your script.

```
require 'vendor/autoload.php';
```

Usage
-----

[](#usage)

### Retrieve Open Graph data from a URL

[](#retrieve-open-graph-data-from-a-url)

```
