PHPackages                             aniftyco/laravel-og-image - 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. aniftyco/laravel-og-image

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

aniftyco/laravel-og-image
=========================

Open Graph Image Generator for Laravel

1572[3 issues](https://github.com/aniftyco/laravel-og-image/issues)PHP

Since Oct 27Pushed 1y ago2 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Open Graph Image Generator for Laravel
======================================

[](#open-graph-image-generator-for-laravel)

Warning

This package is not ready for general consumption

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

[](#requirements)

Requires PHP 8.1+ and a Chrome/Chromium 65+ executable.

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

[](#installation)

You can install the package via Composer:

```
composer require aniftyco/laravel-og-image:dev-master
```

Usage
-----

[](#usage)

There are multiple ways you can utilize this.

### `GET /og-image` Route

[](#get-og-image-route)

This package registers a `GET` route to `/og-image` which accepts a varadic amount of parameters where only `template` is required and special. This tells the image generator what template to use relavent to `resources/views/og-image/`.

Take this example:

```
https://example.com/og-image?template=post&title=You%20Can%20Just%20Do%20Things

```

It is telling the generator to use the `post` template and pass the `$title` property set to `You Can Just Do Things`.

### `og_image()` Helper

[](#og_image-helper)

Using the `og_image()` helper you have more control over what happens with the OG Images generated. This helper accepts a `template` and an array of data to pass to the view.

#### Returning the OG image as a response:

[](#returning-the-og-image-as-a-response)

```
Route::get('/{user}.png', function(User $user) {
    return og_image('user', compact('user'));
});
```

#### Saving the OG image to a disk:

[](#saving-the-og-image-to-a-disk)

```
$image = og_image('user', compact('user'));

$image->storeAs('og-images', ['disk' => 's3']);
```

### Writing templates with Blade

[](#writing-templates-with-blade)

Your images are generated using Blade templates, using the following example template in `resources/views/og-image/example.blade.php`:

```

    @vite(['resources/css/app.css'])

        {{ $name }}

        {{ $text }}

```

Then if you make a request to `/og-image?template=example&name=OG%20Image%20Generator&text=The%20fastest%20way%20to%20create%20open%20graph%20images%20for%20Laravel!` you will get the following image:

[![](.github/assets/example.png)](.github/assets/example.png)

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

[](#contributing)

Thank you for considering contributing to the Attachments for Laravel package! You can read the contribution guide [here](CONTRIBUTING.md).

License
-------

[](#license)

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

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance25

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity16

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

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

---

Top Contributors

[![joshmanders](https://avatars.githubusercontent.com/u/352113?v=4)](https://github.com/joshmanders "joshmanders (15 commits)")

---

Tags

laravellaravel-packageog-imageopengraph-imagesopengraphprotocol

### Embed Badge

![Health badge](/badges/aniftyco-laravel-og-image/health.svg)

```
[![Health](https://phpackages.com/badges/aniftyco-laravel-og-image/health.svg)](https://phpackages.com/packages/aniftyco-laravel-og-image)
```

PHPackages © 2026

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