Get expert guidance in a few days with a Laravel code review

Generate awesome open graph images with Open Graphy

Last updated on by

Generate awesome open graph images with Open Graphy image

The Open Graph protocol, initially introduced by Facebook in 2010, is a set of technologies that allows web developers to control how their web pages are represented when shared on social media platforms. By enabling your pages to become "rich" objects in a social graph, Open Graph meta tags dictate the title, description, image, and other vital information that appears in social media previews. This is where Open Graphy steps in: it's a neat Laravel package designed to generate these essential Open Graph images for your application dynamically. Open Graphy helps you to create social cards on the fly, either leveraging its intuitive default templates or allowing you to create your own, ensuring your content always makes a striking impression across social networks.

Main Features

  • Easily generate open graph images for your website.
  • Add a title, an image, and your logo to the Open Graph image.
  • Add a screenshot of the page inside the open graph image to show the preview of the page.
  • 5 different default templates to choose from, stripes, nodes, sunny, verticals and strings.
  • Customize the colours and styles of the templates.
  • Cache the generated images.
  • Create your own template if you want.

Note: Open Graphy requires the Chrome or Chromium browser to be installed on your server to render the images. The README file provides instructions on how to install this on Ubuntu/Debian and MacOS.

Assuming you already have Chrome or Chromium installed, you can then install this package using Composer:

composer require saasykit/laravel-open-graphy

You can also publish the config so you can customize further:

php artisan vendor:publish --tag="open-graphy-config"

Finally, you add the following component to your Blade template in the <head></head> tags:

<x-open-graphy::links title="Laravel News Open Graphy Demo" template="sunny" />

This will output the following:

<meta property="og:image" content="{URL}">
<meta property="og:image:type" content="image/png">
<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="{URL}">

Here is a sample of an Open Graph image generated using Open Graphy with the sunny template and the Laravel News logo:

Learn more about this package and view the source code on GitHub.

Yannick Lyn Fatt photo

Staff Writer at Laravel News and Full stack web developer.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

image
Laravel Code Review

Get expert guidance in a few days with a Laravel code review

Visit Laravel Code Review
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
Get expert guidance in a few days with a Laravel code review logo

Get expert guidance in a few days with a Laravel code review

Expert code review! Get clear, practical feedback from two Laravel devs with 10+ years of experience helping teams build better apps.

Get expert guidance in a few days with a Laravel code review
PhpStorm logo

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm
Laravel Cloud logo

Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Cloud
Acquaint Softtech logo

Acquaint Softtech

Acquaint Softtech offers AI-ready Laravel developers who onboard in 48 hours at $3000/Month with no lengthy sales process and a 100 percent money-back guarantee.

Acquaint Softtech
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
MongoDB logo

MongoDB

Enhance your PHP applications with the powerful integration of MongoDB and Laravel, empowering developers to build applications with ease and efficiency. Support transactional, search, analytics and mobile use cases while using the familiar Eloquent APIs. Discover how MongoDB's flexible, modern database can transform your Laravel applications.

MongoDB

The latest

View all →
Debounceable Queued Jobs in Laravel 13.6.0 image

Debounceable Queued Jobs in Laravel 13.6.0

Read article
Build Custom Middleware for Query Performance Monitoring and Optimization in Laravel with MongoDB image

Build Custom Middleware for Query Performance Monitoring and Optimization in Laravel with MongoDB

Read article
Laravel API Starter Kits Are Coming Soon! image

Laravel API Starter Kits Are Coming Soon!

Read article
An Opinionated Agent Skill for Building REST APIs in Laravel image

An Opinionated Agent Skill for Building REST APIs in Laravel

Read article
Launch Your Dream SaaS Application with SaaSykit image

Launch Your Dream SaaS Application with SaaSykit

Read article
Generate, Parse, and Convert Documents in PHP with Paperdoc image

Generate, Parse, and Convert Documents in PHP with Paperdoc

Read article