Download the PHP package kehet/imagick-layout-engine without Composer
On this page you can find all versions of the php package kehet/imagick-layout-engine. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kehet/imagick-layout-engine
More information about kehet/imagick-layout-engine
Files in kehet/imagick-layout-engine
Package imagick-layout-engine
Short Description This is my package imagick-layout-engine
License MIT
Homepage https://github.com/kehet/imagick-layout-engine
Informations about the package imagick-layout-engine
This is my package imagick-layout-engine
A PHP library for creating complex image layouts with automatic positioning and sizing. This library provides a flexbox-like approach to image composition, making it easy to create structured layouts with text, images, and shapes.
Requirements
- PHP 8.3 or higher
- Linux (Windows not tested)
- Imagick PHP extension
Installation
You can install the package via composer:
Basic Usage
For more examples, see examples/
Features
Containers
The library provides two types of containers for layout:
- RowContainer: Arranges items horizontally
- ColumnContainer: Arranges items vertically
Containers can be nested to create complex layouts. When adding items to containers, you can specify an optional weight parameter to control the item's size relative to other items.
Padding
Containers support padding, which adds space between the container's edge and its content. The padding feature works similar to CSS padding, with support for one to four values:
- Single value: applies the same padding to all sides
- Two values: first value applies to top and bottom, second value applies to left and right
- Three values: first value applies to top, second value applies to left and right, third value applies to bottom
- Four values: values apply to top, right, bottom, and left, respectively
Text Handling
The library provides two classes for text handling:
- Text: Renders text with automatic font size adjustment to fit within the container
- TextWrap: Renders text with automatic wrapping and font size adjustment
Available gravity options:
Gravity::TOP_LEFT
(default)Gravity::TOP
Gravity::TOP_RIGHT
Gravity::LEFT
Gravity::CENTER
Gravity::RIGHT
Gravity::BOTTOM_LEFT
Gravity::BOTTOM
Gravity::BOTTOM_RIGHT
Image Handling
The library provides an Image class for adding images to layouts with various fitting and positioning options:
Available gravity options:
Gravity::TOP_LEFT
Gravity::TOP
Gravity::TOP_RIGHT
Gravity::LEFT
Gravity::CENTER
(default)Gravity::RIGHT
Gravity::BOTTOM_LEFT
Gravity::BOTTOM
Gravity::BOTTOM_RIGHT
Advanced Examples
Nested Containers
Text and Images Together
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Roadmap
- [x] Margin / padding
- [ ] Text background
- [ ] Extract helper functions
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Kehet
- All Contributors
License
GNU GENERAL PUBLIC LICENSE version 3. Please see License File for more information.
All versions of imagick-layout-engine with dependencies
ext-imagick Version *