Odin aims to render randomly generated planets, moons and star fields as PNG images.
Here is an picture entirely generated by Odin:
$planet = new Odin\Planet();
$image = $planet
->diameter(300) // a 300px wide planet
->lava() // a planet with the lava biome
->render();
// $image is a \SplFileObject, you're free to do what you want with it
A planet can have the following biomes: toxic
, forest
, ashes
, violet
, lava
, atoll
, coldGaz
, hotGaz
, hydroGaz
.
$moon = new Odin\Moon();
$image = $moon
->diameter(150) // a 150px wide moon
->render();
// $image is a \SplFileObject, you're free to do what you want with it
It's possible to render the same planet several times (it works also for moons and star fields). You'll get the same image results.
$planet = new Odin\Planet();
$planet->diameter(300)->lava();
$firstImage = $planet->render();
// do some other stuff...
$secondImage = $planet->render();
// $firstImage and $secondImage are two different files, but their content are identical
Objects rendering can be configured.
$configuration = new Odin\Configuration();
$planet = new Planet($configuration);
It's possible to define where the images will be rendered. By default, they will be generated in /tmp
.
$configuration = new Odin\Configuration('my/custom/path/for/images');
It's possible to render the same object in different PHP processes or requests. To achieve that, you just need to pass the seed
to your the configuration.
$seed = 42;
$moon = new Odin\Configuration(null, $seed);
./vendor/bin/phpspec run