Download the PHP
package lounisbou/php-distance without Composer
On this page you can find all versions of the php package
lounisbou/php-distance. It is possible to download/install
these versions without Composer. Possible dependencies are resolved
automatically.
Vendor lounisbou Package php-distance Short Description A PHP library for calculating the distance between two geographical points on Earth using various Earth radius values. License
MIT
After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.
Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.
In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories.
In this case some credentials are needed to access such packages.
Please use the auth.json textarea to insert credentials, if a package is coming from a private repository.
You can look here for more information.
Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
To use Composer is sometimes complicated. Especially for beginners.
Composer needs much resources. Sometimes they are not available on a simple webspace.
If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
php-distance is a simple PHP library for calculating the distance between two geographical points on Earth. It supports different Earth radius values and various distance calculation formulas.
Installation
Use Composer to install the library:
Usage
Define Points
Define geographical points using the Point class:
Calculate Distance Using Haversine Formula
Use the Route class with the HaversineCalculator to calculate the distance using the Haversine formula:
Calculate Distance Using Vincenty Formula
Use the Route class with the VincentyCalculator to calculate the distance using Vincenty's formula:
Distance Calculation Formulas
Haversine Formula
The Haversine formula is an equation giving great-circle distances between two points on a sphere from their longitudes and latitudes. It is useful for calculating the shortest distance over the earth's surface.
Vincenty Formula
Vincenty's formulae are two related iterative methods used in geodesy to calculate the distance between two points on the surface of an ellipsoid. They are accurate for long distances.
MySQL Formula
The MySQL formula is a simplified version of the Haversine formula that can be used in MySQL queries to calculate distances between two points.
Custom Earth Radius
You can specify a custom Earth radius if needed:
Adding More Formulas
You can extend the library by adding more distance calculation formulas. Implement the DistanceCalculatorInterface to create a new calculator:
Contributing
Contributions are welcome! Please feel free to submit a Pull Request or open an Issue on GitHub.
License
This library is licensed under the MIT License. See the LICENSE file for details.
Composer command for our command line client (download client)This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free.Standard composer command
The package lounisbou/php-distance contains the following files
Loading the files please wait ....
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.