yilanboy / preview
Generate the preview image
1.0.1
2024-12-21 10:40 UTC
Requires
- php: ^8.2
- ext-gd: *
Requires (Dev)
- pestphp/pest: ^3.0.0
This package is auto-updated.
Last update: 2026-04-27 16:03:46 UTC
README
A simple package to generate a preview image.
Installation
Install the package with composer.
composer require yilanboy/preview
Then create an image builder.
use Yilanboy\Preview\Image\Builder; new Builder() ->size(width: 1200, height: 600) ->backgroundColor('#777bb3') ->header(text: 'Preview', color: 'white', fontSize: 75) ->title(text: 'A simple PHP package to create preview image', color: 'white', fontSize: 50) ->output();
This code will display the following image on the web page.
You can modify the text on the preview image.
Currently, the text only supports English and Chinese.
Start a Local Server to Show the Image
There is a output.php file in examples folder, you can start a local server to see the image in browser.
php -S localhost:8000 examples/output.php
Then open your browser and visit localhost:8000.
Run Tests
composer run-tests
