🔴

OG Images for Laravel

OG images for Laravel — add to your Blade templates in 60 seconds

OGMagic works with Laravel's Blade templates. Generate unique OG images for every page using route data — no packages to install.

Quick Start

Add OGMagic to your Laravel project — no packages to install, no API keys to configure.

Static OG Image
{{-- resources/views/layouts/app.blade.php --}}
<head>
  @php
    $ogUrl = 'https://ogmagic.dev/api/og?' . http_build_query([
      'template' => 'gradient-mesh',
      'title'    => $title ?? config('app.name'),
      'description' => $description ?? '',
      'domain'   => parse_url(config('app.url'), PHP_URL_HOST),
    ]);
  @endphp
  <meta property="og:image" content="{{ $ogUrl }}" />
  <meta property="og:image:width" content="1200" />
  <meta property="og:image:height" content="630" />
  <meta name="twitter:card" content="summary_large_image" />
  <meta name="twitter:image" content="{{ $ogUrl }}" />
</head>

Dynamic OG Images

Generate unique OG images per page using route data:

Dynamic per-page
{{-- resources/views/blog/show.blade.php --}}
@section('head')
  @php
    $ogUrl = 'https://ogmagic.dev/api/og?' . http_build_query([
      'template' => 'minimal-dark',
      'title'    => $post->title,
      'description' => Str::limit($post->excerpt, 100),
      'domain'   => parse_url(config('app.url'), PHP_URL_HOST),
    ]);
  @endphp
  <meta property="og:image" content="{{ $ogUrl }}" />
  <meta property="og:image:width" content="1200" />
  <meta property="og:image:height" content="630" />
  <meta name="twitter:card" content="summary_large_image" />
@endsection

{{-- Also works with Inertia.js --}}
// HandleInertiaRequests middleware
Inertia::share('ogImage', fn () => 'https://ogmagic.dev/api/og?...');

💡 Works with Blade templates, Inertia.js (Vue/React), and Livewire. Use http_build_query() for clean URL construction. No Composer packages needed.

Why use OGMagic with Laravel?

No build step

Images are generated on-demand via URL. No build plugins, no CI/CD changes.

🎨

55+ templates

Professional designs out of the box. Customize with query parameters.

🔑

No API key needed

Free tier works instantly — just use the URL. No signup, no config.

📱

Every platform

Optimized 1200×630 images that look great on Twitter/X, Facebook, LinkedIn, Discord, and Slack.

Ready to add OG images to your Laravel app?

Start with 50 free API calls/month. No signup needed.

Also works with