ldebrouwer / distance
Distance helps you calculate the distance between GPS coordinates, in vanilla PHP. Pure and simple.
v1.0
2026-02-23 20:23 UTC
Requires
- php: >=8.4
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-strict-rules: ^2.0
- phpunit/phpunit: ^13.0
- roave/security-advisories: dev-latest
- slevomat/coding-standard: ^8.27
- squizlabs/php_codesniffer: ^4.0
README
Distance helps you calculate the distance between GPS coordinates, in vanilla PHP. Pure and simple.
Installation
Using Composer
When using Composer you can always load in the latest version.
{
"require": {
"ldebrouwer/distance": "^1.0"
}
}
Check it out on Packagist.
Usage
$distance = new Distance() ->setFormula(Formula::HAVERSINE) ->setUnit(Unit::KILOMETRES) ->between(37.331741, -122.030333, 37.422546, -122.084250);
Still to come
- Expanded unit support.
- Documentation.