PHPackages                             black/geo - 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. black/geo

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

black/geo
=========

PHP 5.4+ library to make working with Geo coordinates safer, easier, and fun

v1.0.1(11y ago)156MITPHPPHP &gt;=5.4.0

Since Oct 9Pushed 11y ago1 watchersCompare

[ Source](https://github.com/pocky/Geo)[ Packagist](https://packagist.org/packages/black/geo)[ Docs](http://www.lablackroom.com)[ RSS](/packages/black-geo/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (3)Used By (0)

Geo
===

[](#geo)

PHP 5.4+ library to make working with Geo coordinates safer, easier, and fun!

[![SensioLabsInsight](https://camo.githubusercontent.com/560815e0beaa4f9c2c35928893373a116178464f4bbf15a49e1b3d882f594c0e/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f65383433333431622d306139312d346161382d613861362d6662653231393064393732342f6269672e706e67)](https://insight.sensiolabs.com/projects/e843341b-0a91-4aa8-a8a6-fbe2190d9724)[![Build Status](https://camo.githubusercontent.com/88f41ec92a6f6bf8e8fe62c42e7d01c8d7c49fd586d7649cc7743e40fc2a13ea/68747470733a2f2f7472617669732d63692e6f72672f626c61636b2d70726f6a6563742f47656f2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/black-project/Geo)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/8c50a8ef5eefb8a405569fe4fc84665d879e1428b5451616481b57783a425c0c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f626c61636b2d70726f6a6563742f47656f2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/black-project/Geo/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/6f428b6b681367b1a417eec21b5dc9e265e1499e47d198079343d46addfd8d88/68747470733a2f2f706f7365722e707567782e6f72672f626c61636b2f67656f2f762f737461626c652e706e67)](https://packagist.org/packages/black/geo)[![Total Downloads](https://camo.githubusercontent.com/6d8bab54e3a25f4e1714ceda36f6baa832c27aa56433f7a0f38e69e978def5da/68747470733a2f2f706f7365722e707567782e6f72672f626c61636b2f67656f2f646f776e6c6f6164732e706e67)](https://packagist.org/packages/black/geo)

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

[](#installation)

The recommended way to install Geo is through [Composer](https://getcomposer.org/):

```
{
    "require": {
        "black/geo": "@stable"
    }
}
```

**Protip:** You should browse the \[`black/geo`\]( page to choose a stable version to use, avoid the `@stable` meta constraint.

Usage
-----

[](#usage)

Usage of this class is simple. First, Geo coordinates are based on three values : latitude, longitude and elevation. Elevation is not required and initialised to 0 if arguments are not provided.

There are three ways to create a Geo object:

```
$geo = new Geo\Coordinates(37.42242, -122.08585, 0);
$geo->getCoordinates(); // will return "37.42242,-122.08585,0"
```

```
Geo\Coordinates::fromCoordinatesAsString("37.42242,-122.08585,0")
    ->getLatitude(); // will return "37.42242"
```

```
Geo\Coordinates::fromCoordinatesAsArray([37.42242, -122.08585, 0])
    ->getCoordinates(); // will return "37.42242,-122.08585,0"
```

**Getter**

List of available getters:

- `getLatitude()`
- `getLongitude()`
- `getElevation()`
- `getCoordinates()`
- `getCoordinatesAsArray()`

**Check if two geo are equals**

- `isEqualTo(Geo $geo)`

**Exception**

If you want to pass 1 or less OR 4 or more arguments, a `Geo\Exception\InvalidCoordinatesException()` will be thrown.

License
-------

[](#license)

Geo is released under the MIT License. See the bundled LICENSE file for details.

Contributing
------------

[](#contributing)

See CONTRIBUTING file.

Credits
-------

[](#credits)

This README is heavily inspired by [Geocoder](https://github.com/geocoder-php/Geocoder) library by the great [@willdurand](https://github.com/willdurand). This guy needs your [PR](http://williamdurand.fr/2014/07/02/resting-with-symfony-sos/) for the sake of the REST in PHP.

Alexandre "pocky" Balmes . Send me [Flattrs](https://flattr.com/profile/alexandre.balmes) if you love my work, [buy me gift](http://www.amazon.fr/registry/wishlist/3OR3EENRA5TSK) or hire me!

###  Health Score

27

—

LowBetter than 46% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

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 ~30 days

Total

2

Last Release

4301d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/86a3a03b53a62ac6bea9885beb48980a4a57dda70e36dc8828d0ececec05a738?d=identicon)[pocky](/maintainers/pocky)

---

Top Contributors

[![pocky](https://avatars.githubusercontent.com/u/204451?v=4)](https://github.com/pocky "pocky (16 commits)")

---

Tags

Value Objectgeocoordinatesblack-projectlibary

### Embed Badge

![Health badge](/badges/black-geo/health.svg)

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

###  Alternatives

[moneyphp/money

PHP implementation of Fowler's Money pattern

4.9k94.9M577](/packages/moneyphp-money)[mjaschen/phpgeo

Simple Yet Powerful Geo Library

1.6k9.5M30](/packages/mjaschen-phpgeo)[stevebauman/location

Retrieve a user's location by their IP Address

1.3k8.9M97](/packages/stevebauman-location)[jmikola/geojson

GeoJSON implementation for PHP

3079.9M96](/packages/jmikola-geojson)[brick/geo

GIS geometry library

2501.5M25](/packages/brick-geo)[geokit/geokit

Geo-Toolkit for PHP

251977.2k6](/packages/geokit-geokit)

PHPackages © 2026

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