Download the PHP package dericcain/geo-things without Composer
On this page you can find all versions of the php package dericcain/geo-things. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dericcain/geo-things
More information about dericcain/geo-things
Files in dericcain/geo-things
Package geo-things
Short Description Takes various inputs and geo-decodes/encodes, etc.
License MIT
Informations about the package geo-things
Geo Thing
Description
Ever need to quickly get the address from a set of coordinates? What about getting the coordinates from an address, or even the distance between 2 addresses? This is a very simple package that uses Google's API to perform those very operations. As a default, you do not have to supply an API key but you will be limited with how many API requests you can make. If you are not making a ton of calls, this should be good enough.
Installation
Use composer to install the package like so:
Usage
It's fairly simple to use the package. You will need to import that package at the top of your PHP file. Once you have done that, you can use the different methods below.
Get Coordinates from Address
If there are no results, or there is an error, the object returned will have an error
attribute giving the reason for the error. Also, the lat
and lng
attributes will be set to null
.
Get Address from Coordinates
Get Distance between Origin and Destination
Helper Functions
Once the package is installed using Composer, you will have access to some global helper functions. This is good if you want to call the different functions in a view, or somewhere else that is a little more difficult to declare use
statements. Here are the helper functions:
Contributing
Please feel free to help with this small project. Let me know if you see a bug, or want to add something. If you do a pull request, make sure that you test your code and all of the tests are passing. This is required before the work will be merged.
Contact
Give me a shout!
- [email protected]
- @dericcain
TODO
- [ ] Get distance between two sets of coordinates
- [ ] Add KM to distance as an option