rhykw / steam-locomotive
Output a steam locomotive in plain-text, HTML, or animated GIF
v1.0.0
2026-08-31 04:17 UTC
Requires
- php: >=5.6
Requires (Dev)
None
Suggests
- ext-gd: Required for GIF output
Provides
None
Conflicts
None
Replaces
None
This package is not auto-updated.
Last update: 2026-11-10 04:39:11 UTC
README
A PHP library that outputs a steam locomotive in plain-text, HTML, or animated GIF.
Installation
composer require rhykw/steam-locomotive
Usage
Plain Text
use Rhykw\SteamLocomotive\SteamLocomotive; // All frames separated by blank lines echo SteamLocomotive::text(); // Single frame (0–3) echo SteamLocomotive::text(0);
HTML (CSS animation)
use Rhykw\SteamLocomotive\SteamLocomotive; // Returns a self-contained <style> + <div> block echo SteamLocomotive::html(); // With options echo SteamLocomotive::html([ 'loop' => true, // loop animation (default: true) 'speed' => 0.15, // seconds per frame (default: 0.15) 'color' => '#333', // text color (default: '#333') 'background' => '#fff', // background color (default: 'transparent') ]);
Animated GIF
Requires the ext-gd PHP extension.
use Rhykw\SteamLocomotive\SteamLocomotive; // Returns binary GIF string — send as HTTP response or save to file $gif = SteamLocomotive::gif(); // Output as HTTP response header('Content-Type: image/gif'); echo $gif; // Save to file file_put_contents('locomotive.gif', $gif); // With options $gif = SteamLocomotive::gif([ 'delay' => 15, // frame delay in 1/100s (default: 15) 'loop' => 0, // 0 = infinite loop (default: 0) 'width' => 600, // image width in pixels (default: 600) 'height' => 160, // image height in pixels (default: 160) 'fg' => [51, 51, 51], // text color [R,G,B] (default: dark gray) 'bg' => [255, 255, 255], // background color [R,G,B] (default: white) ]);
Requirements
- PHP >= 5.6
ext-gd(only for GIF output)
License
MIT