PHP helpers to create FLYYER image URLs

2.1.2 2021-10-20 15:32 UTC

This package is auto-updated.

Last update: 2022-05-21 15:10:05 UTC


The AI-powered preview system built from your website (no effort required).

Flyyer live image

This package is agnostic to any PHP framework.


Get started (5 minutes)

Haven't registered your website yet? Go to and create a project (e.g. website-com).

1. Install the library

This package supports PHP >= 7.1.

composer require flyyer/flyyer

2. Get your smart image link

In your website code (e.g. your landing or product/post view file), set the following:

$flyyer = new Flyyer(
  // Your project slug
  // The current path of your website
  '/path/to/product', // in Laravel 6 you can use `Route::getCurrentRoute()->getName()`
// (Optional, Recommended) Default or main image for each page
$flyyer->default = "/static/image-1.png" # or

// Check:
// >

3. Put your smart image link in your <head> tags

You'll get the best results like this:

<meta property="og:image" content="{{ $flyyer->href() }} ">
<meta name="twitter:image" content="{{ $flyyer->href() }} ">
<meta name="twitter:card" content="summary_large_image">

4. Create a rule for your project

Go to your dashboard here and create a rule like the following:

Flyyer basic rule example


Advanced usage

Here you have a detailed full example for project website-com and path /path/to/product.

Advanced features include:

  • Custom variables: additional information for your preview that is not present in your website. [Note: if you need customization you should take a look at Flyyer Render]
  • Custom metadata: set custom width, height, resolution, and more (see example).
  • Signed URLs.
$flyyer = new Flyyer(
  // [Required] Your project slug, find it in your dashboard
  // [Recommended] The current path of your website (by default it's `/`).
  // [Optional] In case you want to provide information that is not present in your page set it here.
    'title' => 'Product name',
    'img' => ''
  // [Optional] Custom metadata for rendering the image. ID is recommended so we provide you with better statistics.
    'id' => 'jeans-123', // recommended for better stats
    'v' => '12369420123', // specific handler version, by default it's a random number to circumvent platforms' cache,
    'width' => 1200,
    'height' => 600,
    'resolution' => 0.9, // from 0.0 to 1.0
    'agent' => 'whatsapp', // force dimensions for specific platform

// Use this image in your <head/> tags (og:image & twitter:image)
// >

For signed URLs, just provide your secret (find it in Dashboard > Project > Advanced settings) and choose a strategy (HMAC or JWT).

$flyyer = new Flyyer(
  [ 'id' => 'jeans-123' ],
  'JWT', // or 'HMAC'

$url = $flyyer->href();
// >

Flyyer Render

As you probably realized, Flyyer uses the rules defined on your dashboard to decide how to handle every image based on path patterns. It analyses your website to obtain information and then render a content-rich image with no effort. Let's say "Flyyer delivers images based on the content of this route".

Flyyer Render instead requires you to explicitly declare template and variables for the images to render, giving you more control for customization. Let's say "FlyyerRender delivers an image using this template and these explicit variables".

$flyyer = new FlyyerRender("tenant", "deck", "template");
$flyyer->variables = [
  "title" => "Hello world!"

// Use this image in your <head/> tags
$url = $flyyer->href();
// >

Variables can be complex arrays and objects.

$flyyer->variables = [
  "items" => [
    ["text" => "Oranges", "count" => 12],
    ["text" => "Apples", "count" => 14]

IMPORTANT: variables must be serializable.

To decode the URL for debugging purposes:

// >!&__v=123


Prepare the local environment:

composer install


Run PHPUnit with:

composer dump-autoload
composer test