LaraCrafts / laravel-geo-routes

GeoLocation restricted routes for Laravel
MIT License
111 stars 5 forks source link

IP to Earth #33

Open nerg4l opened 4 years ago

nerg4l commented 4 years ago

Add support for IP to Earth Heroku add-on.

Heroku is getting more and more popular because of the cheap price and simple deployment. It would be beneficial to support one of their add-on.

yak0d3 commented 4 years ago

Would you please elaborate a bit more? How could IP to Earth benefit this package?

nerg4l commented 4 years ago

We could add a driver to stevebauman's location package.

The short description of this add-on for Heroku states the following:

Find the Country and City of origin for an IP Address

This could be a useful feature for developers who already integrated their services to Heroku.

yak0d3 commented 4 years ago

Do you mean supporting geo-constraints with not only countries but also cities and regions? (e.g. ->allowFrom('Virginia Beach, VA, US'))

nerg4l commented 4 years ago

Under the hood this package is using stevebauman/location which has 5 drivers (IpApi, IpApiPro, IpInfo, GeoPlugin, MaxMind). The proposal is to add an other driver which is using a Heroku add-on called IP to Earth.

When using this add-on you send a request to https://iptoearth.expeditedaddons.com/?api_key={{API_KEY}}&ip={{IP}} and receive a response. The respond contains country_code which can be used for the filter.