PHPackages                             jbelien/mapfile-php-library - 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. jbelien/mapfile-php-library

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

jbelien/mapfile-php-library
===========================

PHP Library to read/write MapServer mapfiles

2.0.0(3y ago)83.8k4[4 PRs](https://github.com/jbelien/MapFile-PHP-Library/pulls)1GPL-2.0PHPPHP ^7.4 || ^8.0

Since Dec 3Pushed 2y ago2 watchersCompare

[ Source](https://github.com/jbelien/MapFile-PHP-Library)[ Packagist](https://packagist.org/packages/jbelien/mapfile-php-library)[ GitHub Sponsors](https://github.com/jbelien)[ Fund](https://liberapay.com/jbelien)[ RSS](/packages/jbelien-mapfile-php-library/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (19)Used By (1)

MapFile-PHP-Library
===================

[](#mapfile-php-library)

[![Latest Stable Version](https://camo.githubusercontent.com/cbc1bf0628a2a30c307b0c3749af7013f964b742029cd2b640b0093997025a95/68747470733a2f2f706f7365722e707567782e6f72672f6a62656c69656e2f6d617066696c652d7068702d6c6962726172792f762f737461626c65)](https://packagist.org/packages/jbelien/mapfile-php-library)[![Total Downloads](https://camo.githubusercontent.com/1a0f43df3db0aa393001c643e010b606c441f4bc6b95e04cf862b97212496b5b/68747470733a2f2f706f7365722e707567782e6f72672f6a62656c69656e2f6d617066696c652d7068702d6c6962726172792f646f776e6c6f616473)](https://packagist.org/packages/jbelien/mapfile-php-library)[![Monthly Downloads](https://camo.githubusercontent.com/188a6892275531694e9dd1f2b4482b3f4c243d540a58052476a5b8def6a46c71/68747470733a2f2f706f7365722e707567782e6f72672f6a62656c69656e2f6d617066696c652d7068702d6c6962726172792f642f6d6f6e74686c792e706e67)](https://packagist.org/packages/jbelien/mapfile-php-library)[![Software License](https://camo.githubusercontent.com/8a0eddede69ef23a1630463cd1e6fe7aaaa25f8d68f6c20ef8a48e09649cc376/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d47504c2d2d322e302d627269676874677265656e2e737667)](LICENSE)

PHP Library to read/write MapServer mapfiles.

This library is based on [MapServer 7.2.0 documentation](https://mapserver.org/mapfile/) (last updated on 16 June 2017).

Installation
------------

[](#installation)

```
composer require jbelien/mapfile-php-library
```

Usage
-----

[](#usage)

### Write MapFile (example)

[](#write-mapfile-example)

```
$map = new \MapFile\Model\Map();

$map->name = 'my-mapfile';
$map->projection = 'EPSG:4326';

$map->scalebar = new \MapFile\Model\Scalebar();
$map->scalebar->units = 'kilometers';

$layer = new \MapFile\Model\Layer();
$layer->name = 'my-layer';
$layer->type = 'POLYGON';
$layer->status = 'ON';
$layer->data = 'my-shapefile';
$layer->projection = 'EPSG:4326';

$class = new \MapFile\Model\LayerClass();

$style = new \MapFile\Model\Style();
$style->color = [0, 0, 0];
$class->style->add($style);

$label = new \MapFile\Model\Label();
$label->text = '[label]';
$label->color = [0, 0, 0];
$label->size = 12;
$class->label->add($label);

$layer->class->add($class);

$map->layer->add($layer);

(new \MapFile\Writer\Map($map))->save('my-mapfile.map');
```

Have a look at the [source code](https://github.com/jbelien/MapFile-PHP-Library/tree/master/src/Model) to see all the available options.

### Parse MapFile (example)

[](#parse-mapfile-example)

```
$map = (new \MapFile\Parser\Map())->parse('my-mapfile.map');

foreach ($map->layer as $layer) {
    echo $layer->name;
}
```

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor1

Top contributor holds 63.5% 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

Every ~169 days

Recently: every ~368 days

Total

14

Last Release

1249d ago

Major Versions

v1.3.1 → v2.0.0-beta2018-09-10

v1.3.2 → v2.0.6-beta2018-12-13

PHP version history (2 changes)v2.0.0-betaPHP ^7.1

v2.0.8-betaPHP ^7.4 || ^8.0

### Community

Maintainers

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

---

Top Contributors

[![jbelien](https://avatars.githubusercontent.com/u/1150563?v=4)](https://github.com/jbelien "jbelien (80 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (39 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (4 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (2 commits)")[![programmerg](https://avatars.githubusercontent.com/u/10964369?v=4)](https://github.com/programmerg "programmerg (1 commits)")

---

Tags

librarymapfilemapscriptmapserverphpphp-library

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/jbelien-mapfile-php-library/health.svg)

```
[![Health](https://phpackages.com/badges/jbelien-mapfile-php-library/health.svg)](https://phpackages.com/packages/jbelien-mapfile-php-library)
```

###  Alternatives

[simshaun/recurr

PHP library for working with recurrence rules

1.6k15.7M40](/packages/simshaun-recurr)[alchemy/zippy

Zippy, the archive manager companion

47522.6M51](/packages/alchemy-zippy)[commerceguys/tax

Tax library with a flexible data model, predefined tax rates, powerful resolving logic.

286763.3k](/packages/commerceguys-tax)[cron/cron-bundle

Symfony cron

1901.5M2](/packages/cron-cron-bundle)[sonata-project/classification-bundle

Symfony SonataClassificationBundle

913.2M20](/packages/sonata-project-classification-bundle)[sylius/promotion

Flexible promotion management for PHP applications.

28477.8k9](/packages/sylius-promotion)

PHPackages © 2026

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