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
README
A simple package to generate 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 support english and chinese.
Start a Local Server to Show the Image
There is a output.php
file in examples
folder, you can simply 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