PHPackages                             ronappleton/php-geojson - 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. ronappleton/php-geojson

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

ronappleton/php-geojson
=======================

GeoJSON object builder.

06PHP

Since May 9Pushed 4y ago1 watchersCompare

[ Source](https://github.com/ronappleton/php-geojson)[ Packagist](https://packagist.org/packages/ronappleton/php-geojson)[ RSS](/packages/ronappleton-php-geojson/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

php-geojson
===========

[](#php-geojson)

GeoJSON object builder.

[![License](https://camo.githubusercontent.com/49011c2941370bd9dbf1a202c0775e327c2ceef189f44ee9b7b52718410c71ce/687474703a2f2f706f7365722e707567782e6f72672f726f6e6170706c65746f6e2f7068702d67656f6a736f6e2f6c6963656e7365)](https://packagist.org/packages/ronappleton/php-geojson)[![PHP Version Require](https://camo.githubusercontent.com/ab06387fc3ba5f3c154db13b5a9b893b422c8e488ef59262e4ebbf2bc4288ecf/687474703a2f2f706f7365722e707567782e6f72672f726f6e6170706c65746f6e2f7068702d67656f6a736f6e2f726571756972652f706870)](https://packagist.org/packages/ronappleton/php-geojson)[![Codacy Badge](https://camo.githubusercontent.com/1c5369db81219b8e995a12b2712c2b50629ce6e210e372c122efde1c9612fb5f/68747470733a2f2f6170702e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f6665356632313264333662613465616361386439383233363262323534656130)](https://www.codacy.com/gh/ronappleton/php-geojson/dashboard?utm_source=github.com&utm_medium=referral&utm_content=ronappleton/php-geojson&utm_campaign=Badge_Grade)[![Codacy Badge](https://camo.githubusercontent.com/253e8e9de002f947c7d4a63654debcd9a738a3ca3e85c03c759f0473d2444d04/68747470733a2f2f6170702e636f646163792e636f6d2f70726f6a6563742f62616467652f436f7665726167652f6665356632313264333662613465616361386439383233363262323534656130)](https://www.codacy.com/gh/ronappleton/php-geojson/dashboard?utm_source=github.com&utm_medium=referral&utm_content=ronappleton/php-geojson&utm_campaign=Badge_Coverage)[![Dependents](https://camo.githubusercontent.com/6316ddd71f0b3b2bd246547a8dc9ebbeadc2fe8f4a23a37dda378c198fa92559/687474703a2f2f706f7365722e707567782e6f72672f726f6e6170706c65746f6e2f7068702d67656f6a736f6e2f646570656e64656e7473)](https://packagist.org/packages/ronappleton/php-geojson)

Introduction
------------

[](#introduction)

This library is a simple builder for GeoJSON objects for use within php.

The inspiration for this is another project I am working on [Tile38 PHP Client](https://github.com/ronappleton/tile38-php-client) in that project part of the requirement is valid GeoJSON objects, so this library is being made to fulfill that requirement.

For more information about GeoJSON objects, please see [This Website](https://terraformer-js.github.io/glossary/) or the official [RFC 7946](https://datatracker.ietf.org/doc/html/rfc7946)

The initial release of this library, will provide the functionality for use within the Tile38 project, the subsequent release will be to ensure full implementation of the rfc, and then the 3rd release will provide unserialisation of GeoJSON data, back into objects.

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

[](#installation)

Please use composer to pull in the package `composer require ronappleton/php-geojson` please note that this library requires php ^8.1, I may at some point release for php ^7.4 but for the moment it is ^8.1, if anyone would like to branch this to other php versions, I will assist.

Usage
-----

[](#usage)

The library provides:

```
RonAppleton\GeoJson\Enums\GeoJsonType::class
RonAppleton\GeoJson\Objects\BoundingBox::class
RonAppleton\GeoJson\Objects\Feature::class
RonAppleton\GeoJson\Objects\FeatureCollection::class
RonAppleton\GeoJson\Objects\GeometryCollection::class
RonAppleton\GeoJson\Objects\LineString::class
RonAppleton\GeoJson\Objects\MultiLineString::class
RonAppleton\GeoJson\Objects\MultiPoint::class
RonAppleton\GeoJson\Objects\MultiPolygon::class
RonAppleton\GeoJson\Objects\Point::class
RonAppleton\GeoJson\Objects\Polygon::class
```

It also provides a factory for convenience, this is `RonAppleton\GeoJson\Objects\Factory::class`

Using the factory provides a simple interface for creating the objects:

```
$point = Factory::make(GeoJsonType::Point);
```

And when making LineStrings for example, you can also pass a count as the second parameter to the factory:

```
[$point, $point2, $point3, $point4] = Factory::make(Point::class, 4);
```

All objects provide a `toArray()` method and a `toJson()` method, when making objects of combined types, like Polygons etc, the toArray and toJson methods cascade through all objects so they will all be converted automatically.

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity26

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/6e2afdd94a6f21a4ec2c5df569b80c1d47d6f5d0428f866f55c4bc117856b58b?d=identicon)[Ron Appleton](/maintainers/Ron%20Appleton)

---

Top Contributors

[![ronappleton](https://avatars.githubusercontent.com/u/3792420?v=4)](https://github.com/ronappleton "ronappleton (37 commits)")

### Embed Badge

![Health badge](/badges/ronappleton-php-geojson/health.svg)

```
[![Health](https://phpackages.com/badges/ronappleton-php-geojson/health.svg)](https://phpackages.com/packages/ronappleton-php-geojson)
```

PHPackages © 2026

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