require 'vendor/autoload.php';
use Kehet\ImagickLayoutEngine\Containers\ColumnContainer;
use Kehet\ImagickLayoutEngine\Containers\RowContainer;
use Kehet\ImagickLayoutEngine\Items\Rectangle;
$imagick->newImage($width, $height, new ImagickPixel('white'));
// Create a root container
$root = new ColumnContainer;
$root->setPadding(20); // padding top=20, right=20, bottom=20, left=20
// Add subcontainers into the root container
(new Rectangle(draw(fill: '#fb4934')))->setPadding(0),
(new Rectangle(draw(fill: '#b8bb26')))->setPadding(25),
(new Rectangle(draw(fill: '#fabd2f')))->setPadding(50),
(new Rectangle(draw(fill: '#83a598')))->setPadding(75),
(new Rectangle(draw(fill: '#d3869b')))->setMargin(0)
(new Rectangle(draw(fill: '#8ec07c')))->setMargin(25)
(new Rectangle(draw(fill: '#fe8019')))->setMargin(50)
(new Rectangle(draw(fill: '#fb4934')))->setMargin(75)
$border = draw(stroke: '#282828', strokeWidth: 5);
(new Rectangle(draw(fill: '#b8bb26')))
(new Rectangle(draw(fill: '#fabd2f')))
(new Rectangle(draw(fill: '#83a598')))
(new Rectangle(draw(fill: '#d3869b')))
// Draw container onto image
$root->draw($imagick, 0, 0, $width, $height);
// Output image as png to file
$imagick->setImageFormat('png');
$imagick->writeImage(__DIR__ . '/02-containers.png');