PHPackages                             kehet/imagick-layout-engine - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. kehet/imagick-layout-engine

ActiveLibrary[Image &amp; Media](/categories/media)

kehet/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.

3.4.0(1mo ago)01.2k↓92.9%GPL-3.0-or-laterPHPPHP ^8.3CI passing

Since Jul 20Pushed 1mo agoCompare

[ Source](https://github.com/Kehet/imagick-layout-engine)[ Packagist](https://packagist.org/packages/kehet/imagick-layout-engine)[ Docs](https://github.com/kehet/imagick-layout-engine)[ GitHub Sponsors](https://github.com/Kehet)[ RSS](/packages/kehet-imagick-layout-engine/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (9)Dependencies (4)Versions (15)Used By (0)

[![Logo Imagick Layout Engine](/art/logo.svg)](/art/logo.svg)

 [![Build Status](https://github.com/Kehet/imagick-layout-engine/actions/workflows/run-tests.yml/badge.svg)](https://github.com/Kehet/imagick-layout-engine/actions) [![Total Downloads](https://camo.githubusercontent.com/a71c0d09b42b4a9c57c4a9bf64decef0d95338bfeeafdcdd9d9c77d48b4836f6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f4b656865742f696d616769636b2d6c61796f75742d656e67696e65)](https://packagist.org/packages/Kehet/imagick-layout-engine) [![Latest Stable Version](https://camo.githubusercontent.com/5ed118c026120fcafd8707d7227b768f4bc5f7fd9f94e1c384db9e9ce78bcf86/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f4b656865742f696d616769636b2d6c61796f75742d656e67696e65)](https://packagist.org/packages/Kehet/imagick-layout-engine) [![License](https://camo.githubusercontent.com/c8585e75dc636f8b6a3be1de1062a603920e84241762340b4e7e8e0a5d9046d7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f4b656865742f696d616769636b2d6c61796f75742d656e67696e65)](https://packagist.org/packages/Kehet/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
------------

[](#requirements)

- PHP 8.3 or later
- Linux (Windows not tested)
- Imagick PHP extension

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require kehet/imagick-layout-engine
```

Basic Usage
-----------

[](#basic-usage)

```
// Create a new image
$width = 1500;
$height = 1000;
$imagick = new Imagick();
$imagick->newImage($width, $height, new ImagickPixel('white'));

// Create a row container with rectangles
$frame = new RowContainer();
$frame->addItem(new Rectangle(draw(fill: '#fee2e2')));
$frame->addItem(new Rectangle(draw(fill: '#fca5a5')));
$frame->addItem(new Rectangle(draw(fill: '#dc2626')));
$frame->addItem(new Rectangle(draw(fill: '#450a0a')));

// Draw container onto image
$frame->draw($imagick, 0, 0, $width, $height);

// Output image as PNG
$imagick->setImageFormat('png');
$imagick->writeImage('output.png');
```

For more examples, see [documentation](https://kehet.github.io/imagick-layout-engine-docs).

Testing
-------

[](#testing)

```
composer test
```

### SAVE\_SNAPSHOT

[](#save_snapshot)

When set, if snapshot file is missing, snapshot image will be automatically written to `tests/__snapshots__/`.

```
SAVE_SNAPSHOT=1 composer test -- --filter=YourTest
```

### SAVE\_IMAGE\_DIFF

[](#save_image_diff)

When set, a visual diff image will be saved to `tests/temp/` whenever an image comparison is performed, regardless of pass/fail.

```
SAVE_IMAGE_DIFF=1 composer test -- --filter=YourTest
```

### Running tests in Docker

[](#running-tests-in-docker)

If you'd rather not use your host PHP install, a `Dockerfile` is provided to run the test suite in a container instead. It doesn't copy the source or install dependencies at build time — the project directory is bind-mounted at run time, so code changes are picked up without rebuilding. Build with `USER_ID`/`GROUP_ID` set to your host user so bind-mounted output (`tests/temp/`, `vendor/`) is written back with your own permissions instead of the container's:

```
docker build --build-arg USER_ID="$(id -u)" --build-arg GROUP_ID="$(id -g)" -t imagick-layout-engine-test .
```

Install dependencies once (and again whenever `composer.json`/`composer.lock` change) by running Composer inside the container — it writes `vendor/` straight to the host through the bind mount:

```
docker run --rm -v "$(pwd):/var/www/html" imagick-layout-engine-test composer install --no-interaction --no-progress --prefer-dist
```

Run the suite:

```
docker run --rm -v "$(pwd):/var/www/html" imagick-layout-engine-test
```

To inspect snapshot diffs on the host, set `SAVE_IMAGE_DIFF` (they land in `tests/temp/` since the project is already mounted):

```
docker run --rm -e SAVE_IMAGE_DIFF=1 -v "$(pwd):/var/www/html" imagick-layout-engine-test
```

To write a missing snapshot, set `SAVE_SNAPSHOT`:

```
docker run --rm -e SAVE_SNAPSHOT=1 -v "$(pwd):/var/www/html" \
  imagick-layout-engine-test composer test -- --filter=YourTest
```

Roadmap
-------

[](#roadmap)

Please see [ROADMAP](ROADMAP.md) for more information on the future of this project.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Credits
-------

[](#credits)

- [Kehet](https://github.com/Kehet)
- [All Contributors](../../contributors)

License
-------

[](#license)

GNU GENERAL PUBLIC LICENSE version 3 or later. Please see [License File](LICENSE) for more information.

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance92

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 77.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~44 days

Recently: every ~63 days

Total

9

Last Release

40d ago

Major Versions

1.0.1 → 2.0.02025-07-20

2.1.0 → 3.0.02025-10-27

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1544301?v=4)[Kehet](/maintainers/Kehet)[@Kehet](https://github.com/Kehet)

---

Top Contributors

[![Kehet](https://avatars.githubusercontent.com/u/1544301?v=4)](https://github.com/Kehet "Kehet (66 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (16 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (3 commits)")

---

Tags

imagemagickphpimagickkehetimagick-layout-engine

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/kehet-imagick-layout-engine/health.svg)

```
[![Health](https://phpackages.com/badges/kehet-imagick-layout-engine/health.svg)](https://phpackages.com/packages/kehet-imagick-layout-engine)
```

###  Alternatives

[intervention/image

PHP Image Processing

14.4k214.2M2.8k](/packages/intervention-image)[league/glide

Wonderfully easy on-demand image manipulation library with an HTTP based API.

2.6k54.0M161](/packages/league-glide)[rosell-dk/webp-convert

Convert JPEG &amp; PNG to WebP with PHP

6039.2M68](/packages/rosell-dk-webp-convert)[intervention/image-laravel

Laravel Integration of Intervention Image

1589.8M226](/packages/intervention-image-laravel)[folklore/image

Image manipulation library for Laravel 5 based on Imagine and inspired by Croppa for easy url based manipulation

269249.0k5](/packages/folklore-image)[orbitale/imagemagick-php

A system that allows creating commands to send to the exec() function to use ImageMagick's powerful features.

43428.3k1](/packages/orbitale-imagemagick-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
