PHPackages                             ogkit/ogkit-laravel - 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. ogkit/ogkit-laravel

ActiveLibrary

ogkit/ogkit-laravel
===================

OG Kit for Laravel

v0.1.0(1mo ago)00MITPHPPHP ^8.2CI passing

Since Mar 18Pushed 1mo agoCompare

[ Source](https://github.com/ogkit-dev/ogkit-laravel)[ Packagist](https://packagist.org/packages/ogkit/ogkit-laravel)[ RSS](/packages/ogkit-ogkit-laravel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (5)Versions (2)Used By (0)

OG Kit for Laravel
==================

[](#og-kit-for-laravel)

A Laravel package for [OG Kit](https://ogkit.dev) — generate Open Graph images from your existing HTML and CSS.

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

[](#installation)

```
composer require ogkit/ogkit-laravel
```

Add your API key to `.env`:

```
OGKIT_API_KEY=your-api-key
```

Optionally publish the config file:

```
php artisan vendor:publish --tag=ogkit-config
```

Usage
-----

[](#usage)

### OG template

[](#og-template)

Use the `@ogTemplate` Blade directives anywhere in your page body to define the HTML that OG Kit should render:

```

        {{ $post->title }}
        {{ $post->excerpt }}

    @ogTemplate

            {{ config('app.name') }}
            {{ $post->title }}
            {{ $post->excerpt }}

    @endOgTemplate

```

OG Kit renders this template from the page itself, so it has access to the same Blade variables, CSS, fonts, images, and other assets or resources that are already available on your site.

This outputs:

```

    ...

```

If you need to build the template string in PHP first, you can also use the facade directly:

```
use OgKit\Facades\OgKit;

$template = OgKit::template('Hello');
```

### Meta tags

[](#meta-tags)

Use the `@ogMeta` Blade directive in your `` to render all the Open Graph and Twitter Card meta tags:

```

    @ogMeta($post->title, $post->excerpt)

```

This renders:

```

```

The URL defaults to the current request URL. You can pass it explicitly, along with a custom type:

```
@ogMeta($title, $description, $canonicalUrl, 'article')
```

### Local preview

[](#local-preview)

Use the `@ogPreview` directive to load the OG Kit preview script. It only outputs in local development, so you can keep it in your layout permanently:

```

    @ogPreview
    @ogMeta($title, $description)

```

Then append `?ogkit-render` to any URL to see your OG image template rendered at 1200x630px.

For package development with Workbench:

```
OGKIT_API_KEY=your-api-key \
OGKIT_BASE_URL=http://127.0.0.1:8001/img/ \
APP_URL=http://127.0.0.1:8000 \
./vendor/bin/testbench serve --host=127.0.0.1 --port=8000
```

### URL generation

[](#url-generation)

If you need the image URL directly (e.g. in an API response or a custom meta tag setup), use the facade:

```
use OgKit\Facades\OgKit;

$imageUrl = OgKit::url('https://yoursite.com/posts/my-post');
// https://ogkit.dev/img/your-api-key.jpeg?url=https%3A%2F%2Fyoursite.com%2Fposts%2Fmy-post
```

Wildcard domains (signed URLs)
------------------------------

[](#wildcard-domains-signed-urls)

If your API key uses a wildcard domain pattern, add your secret key to `.env`:

```
OGKIT_SECRET_KEY=your-secret-key
```

When a secret key is configured, all generated URLs automatically include an HMAC-SHA256 signature:

```
https://ogkit.dev/img/your-api-key.jpeg?url=...&signature=abc123...

```

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

[](#configuration)

```
// config/ogkit.php

return [
    // Your OG Kit API key
    'api_key' => env('OGKIT_API_KEY', ''),

    // Secret key for wildcard domain signing
    'secret_key' => env('OGKIT_SECRET_KEY', ''),

    // OG Kit API base URL
    'base_url' => env('OGKIT_BASE_URL', 'https://ogkit.dev/img/'),

    // Environments where the preview script is loaded
    'preview_environments' => ['local'],
];
```

License
-------

[](#license)

MIT

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance90

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity36

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

53d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1430546?v=4)[Peter Suhm](/maintainers/petersuhm)[@petersuhm](https://github.com/petersuhm)

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

---

Top Contributors

[![petersuhm](https://avatars.githubusercontent.com/u/1430546?v=4)](https://github.com/petersuhm "petersuhm (5 commits)")

---

Tags

laravelogkit

###  Code Quality

Static AnalysisPHPStan

### Embed Badge

![Health badge](/badges/ogkit-ogkit-laravel/health.svg)

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

###  Alternatives

[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k84.2M225](/packages/laravel-horizon)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.3k](/packages/illuminate-database)[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

423715.4k1](/packages/clickbar-laravel-magellan)[spatie/laravel-prometheus

Export Laravel metrics to Prometheus

2651.3M6](/packages/spatie-laravel-prometheus)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

3786.5k](/packages/harris21-laravel-fuse)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)

PHPackages © 2026

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