Geo
PHP 5.4+ library to make working with Geo coordinates safer, easier, and fun!, (*1)
, (*2)
Installation
The recommended way to install Geo is through Composer:, (*3)
{
"require": {
"black/geo": "@stable"
}
}
Protip: You should browse the [black/geo
](https://packagist.org/packages/black/geo page to choose a stable version to use, avoid the @stable
meta
constraint., (*4)
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., (*5)
There are three ways to create a Geo object:, (*6)
$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, (*7)
List of available getters:, (*8)
getLatitude()
getLongitude()
getElevation()
getCoordinates()
getCoordinatesAsArray()
Check if two geo are equals, (*9)
Exception, (*10)
If you want to pass 1 or less OR 4 or more arguments, a Geo\Exception\InvalidCoordinatesException()
will be thrown., (*11)
License
Geo is released under the MIT License. See the bundled LICENSE file for details., (*12)
Contributing
See CONTRIBUTING file., (*13)
Credits
This README is heavily inspired by Geocoder library by the great @willdurand.
This guy needs your PR for the sake of the REST in PHP., (*14)
Alexandre "pocky" Balmes alexandre@lablackroom.com.
Send me Flattrs if you love my work, buy me gift or hire me!, (*15)