1. Go to this page and download the library: Download darrynten/pslayers library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
// Bare minimum for a blank layer
$layerConfig = [
'id' => 14,
'width' => 100,
'height' => 100,
];
$layer = new BlankLayer($layerConfig);
// getting
$width = $layer->width(); // $width = 100
// setting
$layer->width(200); // $width = 200
$layer->composite(Imagick::COMPOSITE_LIGHTEN);
// Make a layer
$layer = new BlankLayer($config);
// Add to your Pslayers object
$pslayer->layers->addLayerToCollection($layer);
// Add with foced z-index (destructive, see notes below)
$pslayer->layers->addLayerToCollection($layer, 2);
// Make a collection
$collection = new LayerCollection();
// Add a layer to a collection
$collection->addLayerToCollection($layer);
// Add a layer with a forced z index (destructive, see notes below)
$collection->addLayerToCollection($layer, 1);