Chameleon is a PHP image manipulation library built around GD.
Please note that it is still in development!
<?php
require __DIR__ . "/vendor/autoload.php";
use Chameleon\Image;
use Chameleon\Vector2;
use Chameleon\Colors\HSLColor;
use Chameleon\Primitives\Rectangle;
use Chameleon\Patterns\BackgroundColor;
$image = Image::create(480, 360);
$imageBackground = new HSLColor(135, 1, 0.3);
$image -> setBackgroundPattern(new BackgroundColor($imageBackground));
$rectanglePosition = new Vector2(50, 50);
$rectangleBackground = new HSLColor(45, 1, 0.5);
$rectangleBorder = new HSLColor(90, 1, 0.8);
$rectangle = new Rectangle($rectanglePosition, 380, 260);
$rectangle -> setBackgroundPattern(new BackgroundColor($rectangleBackground))
-> setBorderPattern(new BackgroundColor($rectangleBorder))
-> setBorderThickness(5);
$image -> draw($rectangle);
header("Content-type: image/png");
$image -> outputFile(IMG_PNG);
?>