PHPackages                             christianessl/landmap-generation - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. christianessl/landmap-generation

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

christianessl/landmap-generation
================================

Generate pixelated, random world maps in PHP.

1.0.0(7y ago)173.8k↑42.2%1[1 issues](https://github.com/IndyIndyIndy/landmap-generation/issues)GPL-2.0-or-laterPHP

Since Feb 26Pushed 2y ago2 watchersCompare

[ Source](https://github.com/IndyIndyIndy/landmap-generation)[ Packagist](https://packagist.org/packages/christianessl/landmap-generation)[ Docs](https://christianessl.at)[ RSS](/packages/christianessl-landmap-generation/feed)WikiDiscussions master Synced today

READMEChangelog (1)DependenciesVersions (2)Used By (0)

landmap-generation
==================

[](#landmap-generation)

Generate pixelated, random world maps in PHP.

[![Code Climate](https://camo.githubusercontent.com/866d25f7504b8dfc79faba7de07d3f84e450ac75e1d674c8b79417f67811fe93/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f496e6479496e6479496e64792f6c616e646d61702d67656e65726174696f6e2e737667)](https://codeclimate.com/github/IndyIndyIndy/landmap-generation)[![Latest Stable Version](https://camo.githubusercontent.com/24b9f92a95427a731fd9676c007247c67642e697cf57bb6427be5c9adcd2112a/68747470733a2f2f706f7365722e707567782e6f72672f63687269737469616e6573736c2f6c616e646d61702d67656e65726174696f6e2f762f737461626c65)](https://packagist.org/packages/christianessl/landmap-generation)[![Total Downloads](https://camo.githubusercontent.com/74a5e388c0e4fbea8abd875a1a81901de89f4e13b701f8fbc605eeb3d979a391/68747470733a2f2f706f7365722e707567782e6f72672f63687269737469616e6573736c2f6c616e646d61702d67656e65726174696f6e2f646f776e6c6f616473)](https://packagist.org/packages/christianessl/landmap-generation)[![Latest Unstable Version](https://camo.githubusercontent.com/8763285a47b3e1d03fdf37fd47823698ef91bd37b55cdf8e5b071d054cde6b6f/68747470733a2f2f706f7365722e707567782e6f72672f63687269737469616e6573736c2f6c616e646d61702d67656e65726174696f6e2f762f756e737461626c65)](https://packagist.org/packages/christianessl/landmap-generation)[![License](https://camo.githubusercontent.com/9317bf3e4b454bdfdee1b97c3d2184f0f4d0f4b5098591e29693d48fc271f368/68747470733a2f2f706f7365722e707567782e6f72672f63687269737469616e6573736c2f6c616e646d61702d67656e65726174696f6e2f6c6963656e7365)](https://packagist.org/packages/christianessl/landmap-generation)

This is a simple landmap generator implemented in PHP. It supports generating a heightmap, setting up a water level, colorizing and shading. The outputted result will be in pixel style.

[![Screenshot](/Images/example.png)](/Images/example.png)

1. Installation
---------------

[](#1-installation)

`composer require christianessl/landmap-generation`.

2. Usage
--------

[](#2-usage)

```
require __DIR__ . '/vendor/autoload.php';

use ChristianEssl\LandmapGeneration\Settings as Settings;
use ChristianEssl\LandmapGeneration\Generator as Generator;
use ChristianEssl\LandmapGeneration\Color as Color;
use ChristianEssl\LandmapGeneration\Color\Shader as Shader;
use ChristianEssl\LandmapGeneration\Enum as Enum;
use ChristianEssl\LandmapGeneration\Utility as Utility;

$seed = 'otters_are_awesome!';
$settings = (new Settings\MapSettings())
    ->setColorScheme(new Color\DefaultColorScheme(new Shader\FlatShader()))
    ->setWidth(500)
    ->setHeight(300)
    ->setWaterLevel(60);

$landmapGenerator = new Generator\LandmapGenerator($settings, $seed);
$map = $landmapGenerator->generateMap();

$image = Utility\ImageUtility::createImage($map);
Utility\ImageUtility::outputImage($image, Enum\FileType::PNG);
```

3. Example output
-----------------

[](#3-example-output)

500x300 pixels

seed: 'otters\_are\_awesome!'

60% water, flat shader

[![Screenshot](/Images/example.png)](/Images/example.png)

30% water, flat shader

[![Screenshot](/Images/example_2.png)](/Images/example_2.png)

60% water, detailed shader

[![Screenshot](/Images/example_3.png)](/Images/example_3.png)

60% water, no shader

[![Screenshot](/Images/example_4.png)](/Images/example_4.png)

4. Configuration options
------------------------

[](#4-configuration-options)

### Class MapSettings

[](#class-mapsettings)

Public methodsDescriptionDefault valuesetWidth()map width in pixels150setHeight()map height in pixels150setColorScheme()the color scheme to useDefaultColorSchemesetWaterLevel()percentage of the map to be water70setInterpolationMode()when set, only every fourth pixel is actually calculated in heightmap generation. (as the calculation costs a lot of performance) Neighbouring pixels will be interpolated. Highly recommended.true### Class DefaultColorScheme

[](#class-defaultcolorscheme)

Constructor argumentsDescriptionDefault valueShaderInterface $shaderThe shader to use for this color scheme. If none is passed, "NullShader" will be used (which does no shading at all).NullShader### Class LandmapGenerator

[](#class-landmapgenerator)

Constructor argumentsDescriptionDefault valueGeneratorSettingsInterface $settingsThe settings for the LandmapGenerator: MapSettings or DefaultSettings.-string $seedSeed for the Random number generator.-HeightmapGeneratorInterface $heightmapGeneratorThe algorithm for generating the heightmap.DiamondSquareHeightmapGeneratorWaterLevelGeneratorInterface $waterLevelGeneratorThe algorithm for placing the water levelWaterLevelGenerator### Implemented Shaders

[](#implemented-shaders)

Class nameDescriptionNullShaderDoes no shading at all.FlatShaderSimple shading with flat looking colors.DetailShaderHighly detailed altitudes in the map. No steps between the colors.TODO
----

[](#todo)

- implement a perlin noise algorithm as example (much faster than diamond square)
- refactor and decouple ImageUtility
- possibility to cache the heightmap generation (maybe as a json tree?)
- port the diamond square algorithm to GO (in another project) and add the option to connect the php project to the GO library

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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

Unknown

Total

1

Last Release

2684d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fe050ed74c95f6c59af207776db4b033790532821cfec7f32a2f932011b3d10b?d=identicon)[IndyIndyIndy](/maintainers/IndyIndyIndy)

---

Top Contributors

[![IndyIndyIndy](https://avatars.githubusercontent.com/u/2108907?v=4)](https://github.com/IndyIndyIndy "IndyIndyIndy (41 commits)")

---

Tags

generatormapgenerationworldlandmap

### Embed Badge

![Health badge](/badges/christianessl-landmap-generation/health.svg)

```
[![Health](https://phpackages.com/badges/christianessl-landmap-generation/health.svg)](https://phpackages.com/packages/christianessl-landmap-generation)
```

###  Alternatives

[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k118.7M718](/packages/symfony-maker-bundle)[simplesoftwareio/simple-qrcode

Simple QrCode is a QR code generator made for Laravel.

2.9k30.5M113](/packages/simplesoftwareio-simple-qrcode)[dasprid/enum

PHP 7.1 enum implementation

382165.7M12](/packages/dasprid-enum)[marc-mabe/php-enum

Simple and fast implementation of enumerations with native PHP

50458.3M110](/packages/marc-mabe-php-enum)[okipa/laravel-table

Generate tables from Eloquent models.

57353.5k](/packages/okipa-laravel-table)[xeeeveee/sudoku

PHP sudoku logic library - Generate and solve sudoku puzzles

2815.5k](/packages/xeeeveee-sudoku)

PHPackages © 2026

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