emptygif
Language: English

All languages and frameworks

Laravel PHP

A PHP snippet for Laravel that answers requests for /pixel.gif with the empty GIF, decoded once at startup.

Laravel PHP

Install
composer create-project laravel/laravel app
File
web.php
Run
php artisan serve --port=8080
<?php

// routes/web.php
use Illuminate\Support\Facades\Route;

Route::get('/pixel.gif', function () {
    $gif = base64_decode('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==');

    return response($gif, 200, [
        'Content-Type' => 'image/gif',
        'Content-Length' => strlen($gif),
        'Cache-Control' => 'no-store',
    ]);
});

We ran this snippet and compared the bytes it returned.

Check it

curl -sI http://localhost:8080/pixel.gif

Official site: Laravel

More in PHP