PictoMock: The Lightweight PHP Placeholder Image Generator You've Been Waiting For

Tired of pulling placeholder images from external services during development? Meet PictoMock — a lightweight PHP package that generates placeholder images locally, with zero external dependencies for SVG output.

The Problem

Every Laravel developer has been there. You're seeding your database, building a prototype, or writing tests that need images. The usual options:

  • External services like placeholder.com — unreliable, slow in CI, and blocked behind firewalls
  • Static files committed to your repo — bloats your repository
  • Manual image creation with GD/Imagick — tedious boilerplate every time

PictoMock solves all three.

Quick Start

composer require laratusk/pictomock
use Laratusk\PictoMock\Facades\PictoMock;

// Generate a WebP placeholder
PictoMock::make()
    ->width(1200)->height(628)
    ->format('webp')
    ->withText()
    ->save('/images');

// SVG with zero dependencies
PictoMock::make()
    ->width(400)->height(300)
    ->format('svg')
    ->withText('Product Image')
    ->toString();

Six Format Support

PictoMock generates images in six formats out of the box:

Format Dependencies Best For
SVG None Web prototypes, fastest generation
PNG GD/Imagick General purpose
JPEG GD/Imagick Photo placeholders
GIF GD/Imagick Legacy support
WebP GD/Imagick Modern web apps
Base64 Varies Inline embedding

FakerPHP Integration

PictoMock integrates seamlessly with FakerPHP for database seeding:

// In your factory
'avatar' => PictoMock::make()
    ->width(200)->height(200)
    ->format('png')
    ->save(storage_path('app/public/avatars')),

No more broken image URLs in your seeds. No more CI failures because an external image service is down.

Zero Dependencies for SVG

The SVG generator requires absolutely no PHP extensions. No GD, no Imagick, no FFI. It generates clean, valid SVG markup that works in every modern browser. This makes it perfect for Docker containers and minimal CI environments.

What's Next

We're working on custom color palettes, pattern backgrounds, and a Blade component for even faster prototyping. Check out the GitHub repo and give it a star!

View on GitHubStar the repo, explore the source code, and get started.
Go to Repository
Share this post
Back to Blog