dmnc / ssip
Super simple (SVG) image placeholders
Installs: 114 398
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 10
Forks: 0
Open Issues: 0
Requires
- php: ^7.0 | ^8.0
Requires (Dev)
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2025-03-09 17:13:49 UTC
README
Introduction
This package is designed to allow the creation of image placeholders with minimal fuss by providing data URIs to be substituted into an img or source's src
or srcset
attributes.
The aim is to create a placeholder that meets the following criteria:
- Behaves exactly like a genuine image when styled and resized.
- Can be used when developing offline.
- Does not require additional JavaScript introduced into the page.
- Keeps data URI size to a minimum.
The only option right now is to use SVG for this.
Installation
composer require dmnc/ssip
Usage
Placeholders are immutable and created directly through their constructor.
use Dmnc\Ssip\Placeholder; $placeholder = new Placeholder(100, 50, "#aaa"); echo '<img src="' . $placeholder . '" alt="Stay accessible out there" />';
Support
Currently tested on:
- Chrome 80
- Firefox 73
- Safari 12.1
- Edge 18
- IE11
- IE10
Alternatives
If you require more feature rich placeholders, and are able to add JavaScript into your page, I suggest the fantastic Holder.js.