paulund/og-image-generator

There is no license information available for the latest version (1.1.0) of this package.

Laravel OG Image Generator

Fund package maintenance!
paulund

1.1.0 2024-10-17 20:44 UTC

This package is auto-updated.

Last update: 2024-10-20 19:23:41 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Laravel package to automatically create a og image that the page generates when it's saved to social media.

Installation

You can install the package via composer:

composer require paulund/og-image-generator
npm install puppeteer
php artisan vendor:publish --provider="Paulund\OgImageGenerator\OgImageGeneratorServiceProvider"

In the <head></head> tag of your application you need to add the meta og-image tag. Pointing to the route created by the package and passing in a variable of $ogTitle which is the text that will appear on the generated image.

<meta property="og:image" content="{{ route('og-image', ['title' => $ogTitle ]) }}" />

Configuration

There is no configuration required for this package. The package will automatically start generating Open Graph images for social media sharing.

But you can configure the package by publishing the config file, which will allow you to change the following configs.

  • Image mime type - default is png
  • Storage disk - default is local
  • Storage path - default is public/og-images

Testing

vendor/bin/testbench workbench:install
composer check

Credits

License

The MIT License (MIT). Please see License File for more information.