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

 *v0.3.0* 

Dynamic OG images for Laravel, designed in your own HTML and CSS.

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

 [Install Laravel OG Kit](https://github.com/mischasigtermans/laravel-ogkit) [View on GitHub](https://github.com/mischasigtermans/laravel-ogkit) 

A static OG image says the same thing for every page you share. Making it dynamic usually means an image pipeline: a headless browser on a server, or text drawn on a canvas in code. [OG Kit](https://ogkit.dev) skips that. You design the image as HTML and CSS, OG Kit screenshots it at 1200x630, and the screenshot URL becomes your `og:image`.

This package is the Laravel side of it. A Blade component, three directives, a service you can call from a controller or a Livewire component, and a set of templates to start from. [Stagent](https://stagent.com) uses it in production.

It is **not** the renderer. OG Kit is a hosted service by [Peter Suhm](https://github.com/petersuhm), so the package needs an OG Kit API key as `OGKIT_API_KEY` in your `.env`.

The templates use Tailwind. Add the package's views to your Tailwind content paths and import its CSS utilities, or the classes won't make it into your build.

What it does
------------

- From a controller or from BladeSet a template with $ogkit-&gt;template() in a controller or Livewire component, or put an &lt;x-ogkit-template&gt; component in a view. @ogkit in your head outputs the og: and twitter: meta tags.
- Templates to start fromBlog posts, product pages with prices, author cards, docs and repositories. Each takes its own fields, such as title, image, price or readingTime.
- Or your own HTMLWrite a custom template in Blade with Tailwind classes, colour props and og- utility classes. Pick any Google Font, a secondary font, and a background pattern or gradient.
- Preview before you shareSet OGKIT\_PREVIEW=true and every HTML response gets an OG Preview button that shows exactly what will be screenshotted.
- A version for cache bustingThe @ogkitUrl directive and $ogkit-&gt;imageUrl() take a version, so a changed design can get a fresh image URL.

[Install Laravel OG Kit](https://github.com/mischasigtermans/laravel-ogkit).
