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(2y ago)5833.9k↓28.8%[1 PRs](https://github.com/longitude-one/geo-parser/pulls)2MITPHPPHP ^8.1CI passing

Since Mar 13Pushed 1w 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 2w ago

READMEChangelog (7)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)[![Coverage Status](https://camo.githubusercontent.com/baf4ef8d7b6308519f3a71bbd0ad0803d475ad4c544588f40a642460282b9ff5/68747470733a2f2f636f6465636f762e696f2f67682f6c6f6e6769747564652d6f6e652f67656f2d7061727365722f67726170682f62616467652e7376673f746f6b656e3d30594338474e5459384c)](https://codecov.io/gh/longitude-one/geo-parser)[![Minimum PHP Version](https://camo.githubusercontent.com/23e0295317e597e4edab3b606243ee4261bfa75c0a93222e1a70b2e36554ac0a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6c6f6e6769747564652d6f6e652f67656f2d7061727365722e7376673f6d61784167653d33363030)](https://camo.githubusercontent.com/23e0295317e597e4edab3b606243ee4261bfa75c0a93222e1a70b2e36554ac0a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6c6f6e6769747564652d6f6e652f67656f2d7061727365722e7376673f6d61784167653d33363030)

[![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
```

Current version:

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

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"
7. 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
8. 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
9. 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
10. Two of any one format separated by whitespace
11. 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`.

Roadmap
-------

[](#roadmap)

\[!NOTE\] A major release may increase the minimum supported PHP version **without introducing any other breaking changes**.

VersionPHP compatibilityTested onDoctrine LexerTested with LexerReleasedActive SupportSecurity fix38.1 - 8.2 - 8.3 - 8.4 - 8.5From 8.1 to 8.5^2.1 - ^3.02.1 3.0 3.1-xdev 4.0-xdev04 May 202431 August 202631 December 202648.3 - 8.4 - 8.58.3 - 8.4 - 8.5^3.0.13.0 3.1-xdev 4.0-xdevAugust 202631 December 202631 December 202758.4 - 8.58.4 - 8.53.0 3.1-xdev 4.0-xdevJanuary 202731 December 202831 December 203068.58.53.0 3.1-xdev 4.0-xdev.January 202831 December 202831 December 2030Version 4 is intended as a transitional release. The only backward compatibility break is the supported PHP versions and the `doctrine/lexer` versions.

PHP versions marked as "tested" and each doctrine lexer version are part of the continuous integration matrix.

### Support Policy

[](#support-policy)

Only the latest major version receives feature and bug fixes. Non-security issues will not be addressed during the security-fixes period.

Previous major versions may receive security fixes only, according to the roadmap above.

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance64

Regular maintenance activity

Popularity43

Moderate usage in the ecosystem

Community11

Small or concentrated contributor base

Maturity55

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

817d 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 (108 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

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

Parser for well-known text (WKT) object strings

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

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

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

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

11.2k980.3M171](/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.

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

Well-known binary (WKB) Parser.

786.4M54](/packages/geo-io-wkb-parser)

PHPackages © 2026

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