PHP code example of pyrsmk / metrogen
1. Go to this page and download the library: Download pyrsmk/metrogen 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/ */
pyrsmk / metrogen example snippets
$metrogen = new Metrogen\Metadata([
'columns' => 8,
'rows' => 5,
'shapes' => ['1x1', '1x3', '3x1', '2x2', '3x2'],
'margin' => 5
]);
$metadata = $metrogen->generate();
var_dump($metadata);
array(13) {
[0] => array(4) {
["x"] => int(0)
["y"] => int(0)
["width"] => int(200)
["height"] => int(600)
}
[1] => array(4) {
["x"] => int(200)
["y"] => int(0)
["width"] => int(400)
["height"] => int(400)
}
[2] => array(4) {
["x"] => int(600)
["y"] => int(0)
["width"] => int(600)
["height"] => int(400)
}
[3] => array(4) {
["x"] => int(1200)
["y"] => int(0)
["width"] => int(400)
["height"] => int(400)
}
[4] => array(4) {
["x"] => int(200)
["y"] => int(400)
["width"] => int(600)
["height"] => int(200)
}
[5] => array(4) {
["x"] => int(800)
["y"] => int(400)
["width"] => int(400)
["height"] => int(400)
}
[6] => array(4) {
["x"] => int(1200)
["y"] => int(400)
["width"] => int(400)
["height"] => int(400)
}
[7] => array(4) {
["x"] => int(0)
["y"] => int(600)
["width"] => int(600)
["height"] => int(200)
}
[8] => array(4) {
["x"] => int(600)
["y"] => int(600)
["width"] => int(200)
["height"] => int(200)
}
[9] => array(4) {
["x"] => int(0)
["y"] => int(800)
["width"] => int(600)
["height"] => int(200)
}
[10] => array(4) {
["x"] => int(600)
["y"] => int(800)
["width"] => int(600)
["height"] => int(200)
}
[11] => array(4) {
["x"] => int(1200)
["y"] => int(800)
["width"] => int(200)
["height"] => int(200)
}
[12] => array(4) {
["x"] => int(1400)
["y"] => int(800)
["width"] => int(200)
["height"] => int(200)
}
}