Recommend this page to a friend! |
Classes of Johnny Mast | Redbox PHP Distance | README.md | Download |
|
Download
Redbox-distanceThis set of classes allow you to calculate the distance between Geo Locations or zipcodes. The information comes from the Google Maps API. Features
Installing via ComposerUse composer to install this package. Run the Composer command to install the latest stable version of Redbox-distance:
After installing, you need to require Composer's autoloader:
System RequirementsThis package only requires the following:
Dit will also require PHPUnit 4.6 but that will be installed upon installing the package using composer. ExamplesLets calculate the distance between Amsterdam and Rotterdam (Netherlands) using GeoLocations:
Calculate the distance between Den Helder and Haarlem (Netherlands) using posalcodes:
Other available calculations are:
and
TroubleshootingIf you get an error regarding SSL connectivity you might want to disable verify peer (CURLOPT_SSL_VERIFYPEER). The calculateDistance class offers a method to disable this. Consider using the setUseSslVerifier() method if needed like so.
Sometimes the postalcode feature could return wrong results. To battle this also add the country to the postalcode like so.
AuthorRedbox-distance is created and maintained by Johnny Mast. For feature requests and suggestions you could consider sending me an e-mail. LicenseThe MIT License Copyright (c) 2017 Johnny Mast (mastjohnny@gmail.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |