Navigator is a PHP library for easily performing geographic calculations and distance unit conversions on Earth or any other spheroid.

Currently it supports distance calculations between two coordinates using Vincenty, Haversine, Great Circle or Cosine Law. By default it uses the most accurate, but computationally intensive: Vincenty.

To calculate the distance between two points on Earth in metres it is as simple as:

```
<?php
use Treffynnon\Navigator as N;
$distance = N::getDistance(10, 81.098, 50.821389, -0.147222);
```

The example above uses decimal notation for the latitude and longitude of the coordinate, but you can also specify them in DMS (degrees, minutes and seconds).

```
<?php
$distance = N::getDistance(10, 81.098, 15.6, '5° 10\' 11.009"W');
```

There are also helpers to swap coordinate notation back and forth between decimals and DMS.

In addition there are utilities for converting distance units between each other including metres to nautical miles, kilometres, miles, parsecs, furlongs and leagues. Custom converts can easily be added to support other units of measurement should you need them.

By default the library will perform calculations on Earth, but Mars and Earth’s Moon have also been configured. Of course it is easy to add new celestial bodies should you need to perform distance calculations on Mercury for some reason!

The code is available on github of course and it is fully documented.