PHPackages                             astrotomic/php-open-graph - 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. astrotomic/php-open-graph

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

astrotomic/php-open-graph
=========================

Easily generate Open Graph tags

1.0.0(2y ago)6244.7k↓27%5[1 PRs](https://github.com/Astrotomic/php-open-graph/pulls)3MITPHPPHP ^8.1

Since Jun 7Pushed 1y ago2 watchersCompare

[ Source](https://github.com/Astrotomic/php-open-graph)[ Packagist](https://packagist.org/packages/astrotomic/php-open-graph)[ Docs](https://github.com/Astrotomic/php-open-graph)[ Fund](https://forest.astrotomic.info)[ GitHub Sponsors](https://github.com/Gummibeer)[ RSS](/packages/astrotomic-php-open-graph/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (15)Used By (3)

PHP Open-Graph
==============

[](#php-open-graph)

[![Latest Version](https://camo.githubusercontent.com/adc58e6c2d1d90ad18fcc173e9f62fd225a817481a32fa48a172028018f04f61/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f617374726f746f6d69632f7068702d6f70656e2d67726170682e7376673f6c6162656c3d52656c65617365267374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/astrotomic/php-open-graph)[![MIT License](https://camo.githubusercontent.com/29071e7dee5f95277414bcfbe8e79a56cfdf3315376c1496b3c472c695392d42/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f417374726f746f6d69632f7068702d6f70656e2d67726170682e7376673f6c6162656c3d4c6963656e736526636f6c6f723d626c7565267374796c653d666f722d7468652d6261646765)](https://github.com/Astrotomic/php-open-graph/blob/master/LICENSE)[![Offset Earth](https://camo.githubusercontent.com/d204555ebe1fb0ae82d10c97b4f4ffc2dfdd2ba1489f98be7f7e8708333a0466/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f54726565776172652d2546302539462538432542332d677265656e3f7374796c653d666f722d7468652d6261646765)](https://plant.treeware.earth/Astrotomic/php-open-graph)[![Larabelles](https://camo.githubusercontent.com/a2c8d5126ddd8c5ddc627176d1d2e0568f8399b50038e71fd7f774c3e24dbe4b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726162656c6c65732d2546302539462541362538342d6c6967687470696e6b3f7374796c653d666f722d7468652d6261646765)](https://www.larabelles.com/)

[![pest](https://camo.githubusercontent.com/cde1742ba81fc9e8c53218ac368d040db2a61086ff96aecf565891aa9e994ee2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f417374726f746f6d69632f7068702d6f70656e2d67726170682f706573743f7374796c653d666c61742d737175617265266c6f676f436f6c6f723d7768697465266c6f676f3d676974687562266c6162656c3d5465737473)](https://github.com/Astrotomic/php-open-graph/actions?query=workflow%3Apest)[![pint](https://camo.githubusercontent.com/1eca3eb648cba09ea7c9c3055700c4155e3202b41903309317a72f7303edb9da/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f417374726f746f6d69632f7068702d6f70656e2d67726170682f70696e743f7374796c653d666c61742d737175617265266c6f676f436f6c6f723d7768697465266c6f676f3d676974687562266c6162656c3d4353)](https://github.com/Astrotomic/php-open-graph/actions?query=workflow%3Apint)[![Total Downloads](https://camo.githubusercontent.com/d3f4fdb9f3521ccbdbb53ceadc7e763bcff37d7663499ef80958ce8d93644c27/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f617374726f746f6d69632f7068702d6f70656e2d67726170682e7376673f6c6162656c3d446f776e6c6f616473267374796c653d666c61742d737175617265)](https://packagist.org/packages/astrotomic/php-open-graph)

This package provides a fluent PHP OOP builder for [Open Graph protocol](https://ogp.me) and [Twitter Cards](https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/abouts-cards).

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

[](#installation)

You can install the package via composer:

```
composer require astrotomic/php-open-graph
```

Usage
-----

[](#usage)

```
use Astrotomic\OpenGraph\OpenGraph;
use Astrotomic\OpenGraph\StructuredProperties\Image;

echo OpenGraph::website('Example')
    ->url('https://example.com')
    ->image('https://example.com/image1.jpg')
    ->image(Image::make('https://example.com/image2.jpg')->width(600));
```

```

```

### Types

[](#types)

#### Global

[](#global)

- `\Astrotomic\OpenGraph\Types\Article`
- `\Astrotomic\OpenGraph\Types\Book`
- `\Astrotomic\OpenGraph\Types\Profile`
- `\Astrotomic\OpenGraph\Types\Website`

#### Music

[](#music)

- `\Astrotomic\OpenGraph\Types\Music\Album`
- `\Astrotomic\OpenGraph\Types\Music\Playlist`
- `\Astrotomic\OpenGraph\Types\Music\RadioStation`
- `\Astrotomic\OpenGraph\Types\Music\Song`

#### Video

[](#video)

- `\Astrotomic\OpenGraph\Types\Video\Episode`
- `\Astrotomic\OpenGraph\Types\Video\Movie`
- `\Astrotomic\OpenGraph\Types\Video\Other`
- `\Astrotomic\OpenGraph\Types\Video\TvShow`

#### Twitter

[](#twitter)

- `\Astrotomic\OpenGraph\Types\Twitter\App`
- `\Astrotomic\OpenGraph\Types\Twitter\Player`
- `\Astrotomic\OpenGraph\Types\Twitter\SummaryLargeImage`
- `\Astrotomic\OpenGraph\Types\Twitter\Summary`

### Structured Properties

[](#structured-properties)

- `\Astrotomic\OpenGraph\StructuredProperties\Audio`
- `\Astrotomic\OpenGraph\StructuredProperties\Image`
- `\Astrotomic\OpenGraph\StructuredProperties\Video`

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/Astrotomic/.github/blob/master/CONTRIBUTING.md) for details. You could also be interested in [CODE OF CONDUCT](https://github.com/Astrotomic/.github/blob/master/CODE_OF_CONDUCT.md).

### Security

[](#security)

If you discover any security related issues, please check [SECURITY](https://github.com/Astrotomic/.github/blob/master/SECURITY.md) for steps to report it.

Credits
-------

[](#credits)

- [Tom Witkowski](https://github.com/Gummibeer)
- [Alex Vanderbist](https://github.com/AlexVanderbist)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Treeware
--------

[](#treeware)

You're free to use this package, but if it makes it to your production environment I would highly appreciate you buying the world a tree.

It’s now common knowledge that one of the best tools to tackle the climate crisis and keep our temperatures from rising above 1.5C is to [plant trees](https://www.bbc.co.uk/news/science-environment-48870920). If you contribute to my forest you’ll be creating employment for local families and restoring wildlife habitats.

You can buy trees at [offset.earth/treeware](https://plant.treeware.earth/Astrotomic/php-open-graph)

Read more about Treeware at [treeware.earth](https://treeware.earth)

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity41

Moderate usage in the ecosystem

Community24

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 61% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~101 days

Recently: every ~279 days

Total

13

Last Release

952d ago

Major Versions

0.6.0 → 1.0.02023-10-09

PHP version history (4 changes)0.1.0PHP ^7.4

0.4.0PHP ^7.1

0.5.2PHP ^7.1 || ^8.0

1.0.0PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6187884?v=4)[Tom Herrmann](/maintainers/Gummibeer)[@Gummibeer](https://github.com/Gummibeer)

---

Top Contributors

[![Gummibeer](https://avatars.githubusercontent.com/u/6187884?v=4)](https://github.com/Gummibeer "Gummibeer (119 commits)")[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (43 commits)")[![sebastiandedeyne](https://avatars.githubusercontent.com/u/1561079?v=4)](https://github.com/sebastiandedeyne "sebastiandedeyne (12 commits)")[![AlexVanderbist](https://avatars.githubusercontent.com/u/6287961?v=4)](https://github.com/AlexVanderbist "AlexVanderbist (10 commits)")[![willemvb](https://avatars.githubusercontent.com/u/1336390?v=4)](https://github.com/willemvb "willemvb (2 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (2 commits)")[![gizburdt](https://avatars.githubusercontent.com/u/1470623?v=4)](https://github.com/gizburdt "gizburdt (2 commits)")[![AdrianMrn](https://avatars.githubusercontent.com/u/12762044?v=4)](https://github.com/AdrianMrn "AdrianMrn (1 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![ben221199](https://avatars.githubusercontent.com/u/12856904?v=4)](https://github.com/ben221199 "ben221199 (1 commits)")[![strebl](https://avatars.githubusercontent.com/u/6151204?v=4)](https://github.com/strebl "strebl (1 commits)")[![djschilling](https://avatars.githubusercontent.com/u/3503166?v=4)](https://github.com/djschilling "djschilling (1 commits)")

---

Tags

hacktoberfestopen-graphopen-graph-protocolphp-open-graphtreewaretwitteropen-graph

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/astrotomic-php-open-graph/health.svg)

```
[![Health](https://phpackages.com/badges/astrotomic-php-open-graph/health.svg)](https://phpackages.com/packages/astrotomic-php-open-graph)
```

###  Alternatives

[chriskonnertz/open-graph

Class that assists in building Open Graph meta tags

117428.6k3](/packages/chriskonnertz-open-graph)[coffeecode/optimizer

Optimizer makes it easy to bookmark your site tags, open graph and twitter card

28260.9k2](/packages/coffeecode-optimizer)[pedroborges/meta-tags

HTML meta tags generator for PHP.

4628.6k1](/packages/pedroborges-meta-tags)[jonom/silverstripe-share-care

Social media sharing previews and customisation for Silverstripe

2932.7k1](/packages/jonom-silverstripe-share-care)[backstage/laravel-og-image

Laravel package to generate dynamic Open Graph images

723.2k](/packages/backstage-laravel-og-image)[devrabiul/laravel-seo-manager

Laravel SEO Manager is an SEO tool that improves SEO by adding recommended meta tags.

404.8k](/packages/devrabiul-laravel-seo-manager)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
