PHPackages                             pyrsmk/metrogen - 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. pyrsmk/metrogen

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

pyrsmk/metrogen
===============

Metro style gallery generator

2.0.0(9y ago)013MITPHPPHP &gt;=5.4.0

Since Sep 9Pushed 9y ago1 watchersCompare

[ Source](https://github.com/pyrsmk/Metrogen)[ Packagist](https://packagist.org/packages/pyrsmk/metrogen)[ RSS](/packages/pyrsmk-metrogen/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (7)Used By (0)

Metrogen 2.0.0
==============

[](#metrogen-200)

Metrogen is a tiny library aiming to automatically create metadata, ready to integrate, for a metro style gallery (as we can see in Windows 8). The position/dimensions of each place in the gallery is randomized.

This library is part of the Myriade 2 project (link coming soon).

Install
-------

[](#install)

```
composer require pyrsmk/metrogen

```

Use
---

[](#use)

The constructor takes several options for generating the gallery :

- `block` : the block size in px (default : `200`)
- `columns` : the number of columns of the workspace (this option is `required`)
- `rows` : the number of rows of the workspace (this option is `required`)
- `shapes` : the list of the different allowed shapes (default : `['1x1', '1x2', '2x1', '2x2']`)
- `margin` : a margin to add around each element (default : `0`)

To create a metro gallery, we divide all the workspace into blocks (with a fixed size in pixels), and then generate shapes (based on the allowed shapes) to add into the gallery. The size of the workspace is fixed to the number of columns and rows, based on the block size.

Here's a quick example, with a workspace of `1600x1000`, other interesting shapes, and a margin :

```
$metrogen = new Metrogen\Metadata([
    'columns' => 8,
    'rows' => 5,
    'shapes' => ['1x1', '1x3', '3x1', '2x2', '3x2'],
    'margin' => 5
]);

$metadata = $metrogen->generate();

var_dump($metadata);
```

It will print :

```
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)
  }
}

```

License
-------

[](#license)

[MIT](http://dreamysource.mit-license.org).

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity62

Established project with proven stability

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 ~100 days

Recently: every ~124 days

Total

6

Last Release

3391d ago

Major Versions

1.0.4 → 2.0.02017-01-25

PHP version history (2 changes)1.0.0PHP &gt;=5.3.0

2.0.0PHP &gt;=5.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/7f97d81cfd6d30587cdae24925bc0899331394d723d04ee4b76eb9435a565fe9?d=identicon)[pyrsmk](/maintainers/pyrsmk)

---

Tags

imagegallerymetro

### Embed Badge

![Health badge](/badges/pyrsmk-metrogen/health.svg)

```
[![Health](https://phpackages.com/badges/pyrsmk-metrogen/health.svg)](https://phpackages.com/packages/pyrsmk-metrogen)
```

###  Alternatives

[intervention/image

PHP Image Processing

14.3k194.3M2.2k](/packages/intervention-image)[league/glide

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

2.6k51.2M116](/packages/league-glide)[spatie/image

Manipulate images with an expressive API

1.4k54.4M137](/packages/spatie-image)[intervention/image-laravel

Laravel Integration of Intervention Image

1496.5M100](/packages/intervention-image-laravel)

PHPackages © 2026

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