Skip to content

This PHP class can replace the Google Distance Matrix to calculate the distance between two points using latitude and longitude. It will prevent you to do massive requests to Google servers and enhance your service performance.

License

Notifications You must be signed in to change notification settings

Bhanditz/php-haversine-formula

 
 

Repository files navigation

World Distance

This PHP class can replace the Google Distance Matrix to calculate the distance between two points using latitude and longitude. It will prevent you to do massive requests to Google's API and enhance your service's performance.

How to use it:

Install the library via Composer or clone the repo:

php composer.phar install rafaelfragoso/haversini-formula

After the installation is complete, you can load the class and start using it.

<?php

use RFHaversini\Distance;

$inKilometers = Distance::toKilometers(30.261699, -97.738967, 29.869229, -97.959595);
$inMiles      = Distance::toMiles(30.261699, -97.738967, 29.869229, -97.959595);

Running tests

php composer.phar test

This will run the tests and generate a coverage folder inside tests.

XDebug is required for test coverage!

About

This PHP class can replace the Google Distance Matrix to calculate the distance between two points using latitude and longitude. It will prevent you to do massive requests to Google servers and enhance your service performance.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%