Download the PHP package hosmelq/laravel-open-graph-image without Composer

On this page you can find all versions of the php package hosmelq/laravel-open-graph-image. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-open-graph-image

Laravel Open Graph Image

Generate dynamic Open Graph images for Laravel applications using Blade templates and Tailwind CSS.

See it in action: a real Open Graph image generated from a Blade + Tailwind template.

OG image example

Source: https://laravel-open-graph-image.hosmelq.com/open-graph-image?template=demo

Introduction

Using this package, you can generate Open Graph images from Blade templates styled with Tailwind CSS. Whether you want to create preview images for blog posts, product cards, or event announcements, this package handles it all.

The image is generated when accessed and cached for subsequent requests.

Requirements

Installation & setup

You can install the package via composer:

Publishing the config file

Optionally, you can publish the config file with this command:

View the published config file.

Configuring Browsershot

This package uses Browsershot for screenshot generation. For detailed requirements and installation instructions, see the Browsershot requirements.

To get started, you'll need to install Puppeteer:

Downloading Tailwind CLI

Download the Tailwind CSS v4 binary:

Basic usage

Getting started

Let's generate an Open Graph image for a blog post. We'll create a Blade template and add the meta component to your page.

First, create a template in resources/views/open-graph-image/templates/post.blade.php:

Now, add the meta component to your page:

The meta component outputs og:image, og:image:width, og:image:height, og:image:type, twitter:card, and twitter:image meta tags. The image is generated when accessed and cached for subsequent requests.

Programmatically generating images

Generate images directly in your code:

Using the preview mode

During development, preview your templates as HTML without generating images:

The preview route is only available in the local environment by default.

[!TIP] Use your browser's Responsive Mode with a 1200×630 viewport to preview templates at the exact Open Graph image dimensions. This speeds up design iteration without regenerating PNGs.

Creating templates

Templates are Blade views stored in resources/views/open-graph-image/templates/.

Simple template

Demo template

Using the image embedding directive

The @embedImage directive converts local images to data URIs. Use paths like public_path('images/logo.png'):

Customizing CSS

The package processes your templates with Tailwind CSS v4. To use custom CSS, publish the default file:

This creates resources/vendor/open-graph-image/css/open-graph-image.css that you can modify:

Alternatively, use your own CSS file from any location:

Testing

Changelog

Please see CHANGELOG.md for more information on what has changed recently.

Credits

License

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


All versions of laravel-open-graph-image with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
laravel/framework Version ^12.0
spatie/browsershot Version ^5.0
spatie/laravel-package-tools Version ^1.92
spatie/temporary-directory Version ^2.3
symfony/process Version ^7.3
thecodingmachine/safe Version ^3.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hosmelq/laravel-open-graph-image contains the following files

Loading the files please wait ....