black/geo
Composer 安装命令:
composer require black/geo
包简介
PHP 5.4+ library to make working with Geo coordinates safer, easier, and fun
README 文档
README
PHP 5.4+ library to make working with Geo coordinates safer, easier, and fun!
Installation
The recommended way to install Geo is through Composer:
{
"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.
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
Geo is released under the MIT License. See the bundled LICENSE file for details.
Contributing
See CONTRIBUTING file.
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.
Alexandre "pocky" Balmes alexandre@lablackroom.com. Send me Flattrs if you love my work, buy me gift or hire me!
统计信息
- 总下载量: 56
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 1
其他信息
- 授权协议: MIT
- 更新时间: 2014-10-08