PHPackages                             longitude-one/geo-parser - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. longitude-one/geo-parser

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

longitude-one/geo-parser
========================

Parser for geography coordinate strings

3.0.1(1y ago)5537.9k—3.3%2MITPHPPHP ^8.1

Since Mar 13Pushed 1y ago1 watchersCompare

[ Source](https://github.com/longitude-one/geo-parser)[ Packagist](https://packagist.org/packages/longitude-one/geo-parser)[ RSS](/packages/longitude-one-geo-parser/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (2)Versions (7)Used By (2)

Geographic parser: longitude-one/geo-parser
===========================================

[](#geographic-parser-longitude-onegeo-parser)

[![longitude-one/geo-parser](https://camo.githubusercontent.com/664912b39397d2330d15843b15c683a3e93705f3df1e25319ca68e5ee755c00a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6f6e6769747564652d2d6f6e652d67656f2d2d7061727365722d626c7565)](https://camo.githubusercontent.com/664912b39397d2330d15843b15c683a3e93705f3df1e25319ca68e5ee755c00a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6f6e6769747564652d2d6f6e652d67656f2d2d7061727365722d626c7565)[![Stable release](https://camo.githubusercontent.com/795218ebfcf9cdee2742f1efb9bfaccea95f8547a1f20aefee855216e6f7ed5b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6c6f6e6769747564652d6f6e652f67656f2d706172736572)](https://camo.githubusercontent.com/795218ebfcf9cdee2742f1efb9bfaccea95f8547a1f20aefee855216e6f7ed5b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6c6f6e6769747564652d6f6e652f67656f2d706172736572)[![Packagist License](https://camo.githubusercontent.com/1147e275253fdf5b53d8c0e0a969e93776975c646b52d440b304c02039b6249f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6c6f6e6769747564652d6f6e652f67656f2d706172736572)](https://github.com/longitude-one/geo-parser/blob/main/LICENSE)

Lexer and parser library for geographic point string values.

[![PHP CI](https://github.com/longitude-one/geo-parser/actions/workflows/ci.yml/badge.svg)](https://github.com/longitude-one/geo-parser/actions/workflows/ci.yml)[![Maintainability](https://camo.githubusercontent.com/bd232a848edacc299f20a814e8fda1b9eb729c1987b37d9113da64c75c02663e/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f33393566363631353039663033656265643065652f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/longitude-one/geo-parser/maintainability)[![Test Coverage](https://camo.githubusercontent.com/e0c1e7ad25624e7be3b497c57feed5e6f50f9915276d5c856ba7ffad1c19691c/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f33393566363631353039663033656265643065652f746573745f636f766572616765)](https://codeclimate.com/github/longitude-one/geo-parser/test_coverage)[![Coverage Status](https://camo.githubusercontent.com/270c447f5e7ef6016ee57188a20dc772901b55e6cd74f6f5c74505a9e75339de/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6c6f6e6769747564652d6f6e652f67656f2d7061727365722f62616467652e737667)](https://coveralls.io/github/longitude-one/geo-parser)[![Minimum PHP Version](https://camo.githubusercontent.com/23e0295317e597e4edab3b606243ee4261bfa75c0a93222e1a70b2e36554ac0a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6c6f6e6769747564652d6f6e652f67656f2d7061727365722e7376673f6d61784167653d33363030)](https://camo.githubusercontent.com/23e0295317e597e4edab3b606243ee4261bfa75c0a93222e1a70b2e36554ac0a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6c6f6e6769747564652d6f6e652f67656f2d7061727365722e7376673f6d61784167653d33363030)[![Tested on PHP 8.1 to 8.3](https://camo.githubusercontent.com/494de5c19bf09f4687347d2f826c523d3b22369d95e0dae56156f946bd6555c5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7465737465642532306f6e2d504850253230253230382e31253230253743253230382e32253230253743253230382e332d627269676874677265656e2e7376673f6d61784167653d32343139323030)](https://github.com/longitude-one/geo-parser/actions)

[![Downloads](https://camo.githubusercontent.com/e2deffb8ea58fd37f02d9844ed6a5df8669cf938340567f0f0d215074580d53e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6c6f6e6769747564652d6f6e652f67656f2d7061727365722e737667)](https://packagist.org/packages/longitude-one/geo-parser)

Note

This package is the continuation of the now abandoned [creof/geo-parser](https://github.com/creof/geo-parser) package.

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

[](#installation)

```
composer require longitude-one/geo-parser
```

Usage
-----

[](#usage)

There are two use patterns for the parser. The value to be parsed can be passed into the constructor, then parse() called on the returned `Parser` object:

```
$input  = '79°56′55″W, 40°26′46″N';

$parser = new Parser($input);

$value = $parser->parse(); // [-79.948611111111, 40.446111111111]
```

If many values need to be parsed, a single `Parser` instance can be used:

```
$input1 = '56.242 E';
$input2 = '40:26:46 S';

$parser = new Parser();

$value1 = $parser->parse($input1); //56.242
$value2 = $parser->parse($input2); //-40.446111111111
```

Supported Formats
-----------------

[](#supported-formats)

Both single values and pairs are supported. Some samples of supported formats are below, though not every possible iteration may be explicitly specified:

1. Simple single-signed values

- 40
- -40
- -8.543
- +132
- +77.2

2. Simple single signed values with degree symbol

- 40°
- -40°
- -5.234°
- +43°
- +38.43°

3. Single unsigned values with or without degree symbol, and cardinal direction

- 40° N
- 40 S
- 56.242 E

4. Single values of signed integer degrees with degree symbol, and decimal minutes with apostrophe

- 40° 26.222'
- -65° 32.22'
- +165° 52.22'

5. Single values of unsigned integer degrees with degree symbol, decimal minutes with apostrophe, and cardinal direction

- 40° 26.222' E
- 65° 32.22' S

6. Single values of signed integer degrees with degree symbol, integer minutes with apostrophe, and optional integer or decimal seconds with quote

- 40° 26' 46"
- -79° 58' 56"
- 93° 19' 25.8"
- +120° 19' 25.8"

6. Single values of signed integer degrees with colon symbol, integer minutes, and optional colon and integer or decimal seconds

- +40:26:46
- -79:58:56
- 93:19:25.8

7. Single values of unsigned integer degrees with degree symbol, integer minutes with apostrophe, optional integer or decimal seconds with quote, and cardinal direction

- 40° 26' 46" S
- 99° 58' 56" W
- 44° 58' 53.9" N

7. Single values of unsigned integer degrees with colon symbol, integer minutes with, optional colon and integer or decimal seconds, and cardinal direction

- 40:26:46 S
- 99:58:56 W
- 44:58:53.9 N

8. Two of any one format separated by whitespace
9. Two of any one format separated by a comma

Return
------

[](#return)

The parser will return an integer/float or an array containing a pair of these values.

Exceptions
----------

[](#exceptions)

The `Lexer` and `Parser` will throw exceptions implementing interface `LongitudeOne\Geo\String\Exception\ExceptionInterface`.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity42

Moderate usage in the ecosystem

Community11

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 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

Every ~14 days

Total

6

Last Release

726d ago

Major Versions

1.0.0 → 2.0.02024-03-18

2.1.0 → 3.0.0.RC2024-03-24

PHP version history (2 changes)1.0.0PHP ^7.4

2.0.0PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5101481?v=4)[Alexandre Tranchant](/maintainers/Alexandre-T)[@Alexandre-T](https://github.com/Alexandre-T)

---

Top Contributors

[![Alexandre-T](https://avatars.githubusercontent.com/u/5101481?v=4)](https://github.com/Alexandre-T "Alexandre-T (85 commits)")

---

Tags

doctrine-ormdoctrine-spatialgeographic-dataphpstringparserlexertextgeometrygeographyspatialgeocoordinate

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/longitude-one-geo-parser/health.svg)

```
[![Health](https://phpackages.com/badges/longitude-one-geo-parser/health.svg)](https://phpackages.com/packages/longitude-one-geo-parser)
```

###  Alternatives

[creof/geo-parser

Parser for geography coordinate strings

624.4M15](/packages/creof-geo-parser)[creof/wkt-parser

Parser for well-known text (WKT) object strings

554.8M16](/packages/creof-wkt-parser)[creof/wkb-parser

Parser for well-known binary (WKB/EWKB) object data

615.1M16](/packages/creof-wkb-parser)[doctrine/lexer

PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.

11.2k910.8M118](/packages/doctrine-lexer)[martin-georgiev/postgresql-for-doctrine

Extends Doctrine with native PostgreSQL support for arrays, JSONB, ranges, PostGIS geometries, text search, ltree, uuid, and 100+ PostgreSQL-specific functions.

4485.3M4](/packages/martin-georgiev-postgresql-for-doctrine)[geo-io/wkb-parser

Well-known binary (WKB) Parser.

786.0M48](/packages/geo-io-wkb-parser)

PHPackages © 2026

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