PHPackages                             abordage/og-images - 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. abordage/og-images

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

abordage/og-images
==================

Generate Open Graph images (og:image, twitter:image, vk:image) for each site pages

0.4.1(2y ago)37.4k↑500%[1 PRs](https://github.com/abordage/og-images/pulls)1MITPHPPHP &gt;=7.4CI passing

Since May 26Pushed 1y ago1 watchersCompare

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

READMEChangelog (10)Dependencies (4)Versions (13)Used By (1)

Open Graph Images Generator
===========================

[](#open-graph-images-generator)

Create Open Graph images (og:image, twitter:image, vk:image) for each (or some) site pages.

[ ![Open Graph Images Generator](https://github.com/abordage/og-images/raw/master/docs/images/default-og-image-830x435.png?raw=true)](https://github.com/abordage/og-images/blob/master/docs/examples.md "Open Graph Images Generator")

[ ![Packagist Version](https://camo.githubusercontent.com/0921d733729d1368867258b493dc09b233ce08f9c5c8051e8571b68e93d2ec5c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61626f72646167652f6f672d696d61676573)](https://packagist.org/packages/abordage/og-images "Packagist version")[ ![GitHub Tests Status](https://camo.githubusercontent.com/fe03ccb1b7c1ef21456afbc37508085132b053e552000ad65dc6eb763d4247b4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f61626f72646167652f6f672d696d616765732f74657374732e796d6c3f6c6162656c3d7465737473)](https://github.com/abordage/og-images/actions/workflows/tests.yml "GitHub Tests Status")[ ![GitHub Code Style Status](https://camo.githubusercontent.com/3c95d24ae3e18ac6890af91cdfa3c75c2b157df78d1d8ccbcf395759d59e5ccc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f61626f72646167652f6f672d696d616765732f7068702d63732d66697865722e796d6c3f6c6162656c3d636f64652532307374796c65)](https://github.com/abordage/og-images/actions/workflows/php-cs-fixer.yml "GitHub Code Style Status")[ ![Packagist PHP Version Support](https://camo.githubusercontent.com/f9bd6fb2d19beb9cab3fd2b6ed2e6c05c6fbebf1ee2bc81beb309a101b179faa/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f61626f72646167652f6f672d696d61676573)](https://www.php.net/ "PHP version")[ ![License](https://camo.githubusercontent.com/2bb5995246d742f8b59d2e82d6280af710ff1443c56d195c21223d8db8fc89dc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f61626f72646167652f6f672d696d61676573)](https://github.com/abordage/og-images/blob/master/LICENSE.md "License")

Use page title to create an eye-catching page preview when users share the link on social networks or instant messengers. [Learn more](https://ogp.me) about Open Graph.

Features:
---------

[](#features)

- Image generation with your text and site name
- Fully customizable (see [configuration](#configuration))
- Small image size (15-50 Kb) with high resolution and quality ([check it](./docs/examples.md))
- Aspect ratios [presets](#images-aspect-ratios) for popular social networks

[▶ **See examples**](./docs/examples.md)

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

[](#requirements)

- PHP 7.4 - 8.3
- The Imagick PHP extension

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

[](#installation)

You can install the package via composer:

```
composer require abordage/og-images
```

> 💡 Using **Laravel**? Check out [abordage/laravel-og-images](https://github.com/abordage/laravel-og-images)

Quick start
-----------

[](#quick-start)

```
use Abordage\OpenGraphImages\OpenGraphImages;

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

$config = ['app_name' => 'alice.wonderland'];
$text = 'The adventures first, explanations take such a dreadful time!';
$path = __DIR__ . '/your-name-for-image.png';

$openGraphImage = new OpenGraphImages($config);
$openGraphImage->make($text)->save($path);
```

> **Note**
> All images are encoded in `PNG` format as it provides the best ratio between size/quality. For the same reason, the package uses the `Imagick` driver - in tests, it showed an advantage in speed and final size of the generated images.

Usage
-----

[](#usage)

```
$openGraphImage = new OpenGraphImages($config);

// for
$openGraphImage->make($text)->save($path);
// or
$openGraphImage->make($text, 'opengraph')->save($path);

// for
$openGraphImage->make($text, 'twitter')->save($path);

// for
$openGraphImage->make($text, 'vk')->save($path);

// custom size
$openGraphImage->makeCustom($text, 600, 400)->save($path);
```

After generation, you need to somehow organize the relationship of images with a specific page (for example, attach to a model). If you already have a solution ready to accept an image and attach it to a specific page, you can get the image as a string instead of saving it:

```
$openGraphImage = new OpenGraphImages($config);
$imageBlob = $openGraphImage->make($text)->get();
```

If after generation you need to get sizes of the image, you can get it as follows:

```
$openGraphImage->make($text, 'twitter')->get();
$imageSizes = $openGraphImage->getImageSizes();
// return [
//    'width' => 1200,
//    'height' => 600
// ];
```

Configuration
-------------

[](#configuration)

```
$config = [
    /*
    |--------------------------------------------------------------------------
    | Background Color
    |--------------------------------------------------------------------------
    |
    | Supported: HEX, RGB or RGBA format
    |
    */
    'background_color' => '#474761',

    /*
    |--------------------------------------------------------------------------
    | Text Color
    |--------------------------------------------------------------------------
    |
    | Supported: HEX, RGB or RGBA format
    |
    */
    'text_color' => '#eee',

    /*
    |--------------------------------------------------------------------------
    | App Name
    |--------------------------------------------------------------------------
    |
    | Set null to disable
    |
    | Supported: string or null
    |
    */
    'app_name' => null,

    /*
    |--------------------------------------------------------------------------
    | App Name Text Color
    |--------------------------------------------------------------------------
    |
    | Supported: HEX, RGB or RGBA format
    |
    */
    'app_name_color' => '#eee',

    /*
    |--------------------------------------------------------------------------
    | App Name Decoration Color
    |--------------------------------------------------------------------------
    |
    | Supported: HEX, RGB or RGBA format
    |
    */
    'app_name_decoration_color' => '#fb3361',

    /*
    |--------------------------------------------------------------------------
    | Text Alignment
    |--------------------------------------------------------------------------
    |
    | Multiline text alignment
    |
    | Supported: "left", "center", "right"
    |
    */
    'text_alignment' => 'left',

    /*
    |--------------------------------------------------------------------------
    | Text Sticky
    |--------------------------------------------------------------------------
    |
    | Supported: "left", "center", "right"
    |
    */
    'text_sticky' => 'center',

    /*
    |--------------------------------------------------------------------------
    | App Name Position
    |--------------------------------------------------------------------------
    |
    | Supported: "top-left", "top-center", "top-right",
    |            "bottom-left", "bottom-center", "bottom-right"
    |
    */
    'app_name_position' => 'bottom-center',

    /*
    |--------------------------------------------------------------------------
    | App Name Decoration Style
    |--------------------------------------------------------------------------
    |
    | Set null to disable
    |
    | Supported: "line", "label", "rectangle", null
    |
    */
    'app_name_decoration_style' => 'line',

    /*
    |--------------------------------------------------------------------------
    | Font Size
    |--------------------------------------------------------------------------
    |
    */
    'font_size' => 55,

    /*
    |--------------------------------------------------------------------------
    | App Name Font Size
    |--------------------------------------------------------------------------
    |
    */
    'app_name_font_size' => 30,

    /*
    |--------------------------------------------------------------------------
    | Text Font
    |--------------------------------------------------------------------------
    |
    | If set null, will be used Preset Font (Roboto Regular)
    |
    | Supported: "absolute/path/to/your/font.ttf", null
    |
    */
    'font_path' => null,

    /*
    |--------------------------------------------------------------------------
    | App Name Font
    |--------------------------------------------------------------------------
    |
    | If set null, will be used Preset Font (Roboto Medium)
    |
    | Supported: "absolute/path/to/your/font.ttf", null
    |
    */
    'app_name_font_path' => null,
];
```

API Reference
-------------

[](#api-reference)

MethodReturnsAdded inChanged in`make(string $text, string $preset = 'opengraph')`self0.1.00.2.0`makeCustom(string $text, int $width, int $height)`self0.2.0-`get()`string0.1.0-`save(string $path)`boolean0.1.0-`getImageSizes()`array0.3.0-### Images aspect ratios

[](#images-aspect-ratios)

PresetAspect ratiosDocs`make(string $text)`1200 x 630 (1.91:1)`make(string $text, 'opengraph')`1200 x 630 (1.91:1)`make(string $text, 'facebook')`1200 x 630 (1.91:1)[fb](https://developers.facebook.com/docs/sharing/webmasters/images/)`make(string $text, 'twitter')`1200 x 600 (2:1)[twitter](https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/summary-card-with-large-image)`make(string $text, 'vk')`1200 x 536 (2.2:1)[vk](https://dev.vk.com/api/posts)Roadmap
-------

[](#roadmap)

Add ability to use gradients and images for the background.

Testing
-------

[](#testing)

Run all tests

```
composer test:all
```

or

```
composer test:phpunit
composer test:phpstan
composer test:phpcs
```

or see

Feedback
--------

[](#feedback)

Find a bug or have a feature request? Open an issue, or better yet, submit a pull request - contribution welcome!

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

[](#contributing)

Please see [CONTRIBUTING](https://github.com/abordage/.github/blob/master/CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- Pavel Bychko ([abordage](https://github.com/abordage))
- [All Contributors](https://github.com/abordage/og-images/graphs/contributors)

License
-------

[](#license)

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

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 64.6% 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 ~66 days

Recently: every ~164 days

Total

11

Last Release

779d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c87a6833167a0a9698e160af28d0c4bbc1813a672ca5dc8a83fbc5cdd7714e06?d=identicon)[abordage](/maintainers/abordage)

---

Top Contributors

[![abordage](https://avatars.githubusercontent.com/u/28537731?v=4)](https://github.com/abordage "abordage (73 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (23 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (17 commits)")

---

Tags

og-imageopen-graphtwitter-imageopengraphopen-graphog-imagetwitter imagevk image

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/abordage-og-images/health.svg)

```
[![Health](https://phpackages.com/badges/abordage-og-images/health.svg)](https://phpackages.com/packages/abordage-og-images)
```

###  Alternatives

[artesaos/seotools

SEO Tools for Laravel and Lumen

3.3k5.1M60](/packages/artesaos-seotools)[embed/embed

PHP library to retrieve page info using oembed, opengraph, etc

2.1k11.0M97](/packages/embed-embed)[chriskonnertz/open-graph

Class that assists in building Open Graph meta tags

117428.6k3](/packages/chriskonnertz-open-graph)[butschster/meta-tags

The most powerful and extendable tools for managing SEO Meta Tags in your Laravel project

628730.7k2](/packages/butschster-meta-tags)[arcanedev/seo-helper

SEO Helper is a framework agnostic package that provides tools &amp; helpers for SEO (Laravel supported).

332467.0k4](/packages/arcanedev-seo-helper)[abordage/laravel-og-images

Generate Open Graph images (og:image, twitter:image, vk:image) for each site pages

122.8k](/packages/abordage-laravel-og-images)

PHPackages © 2026

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