Skip to content
Free IP geolocation API made in Lumen.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app
bootstrap
database
public
resources/views
routes
storage
tests
.env.example
.gitignore
LICENSE
README.md
artisan
composer.json
composer.lock
phpunit.xml

README.md

freegeoip-lumen

A free IP geolocation API made in Lumen 5.7

Overview

A very simply API to host your own IP geolocation software without paying a cent! Just follow the quick installation steps then edit the homepage the way you want it, and please remember to give credit! 😉 Please see the LICENSE.

Features

  • Different formats: JSON, XML and CSV (feel free to add more)
  • Caches IP addresses forever instead of searching millions of IPs (optional)
  • Saves locations in database (optional)

Endpoints

Endpoint Note
/ Shows the homepage view
/json Returns geolocation for the request in JSON
/json/{ip} Returns geolocation for the requested IP address in JSON
/xml Returns geolocation for the request in XML
/xml/{ip} Returns geolocation for the requested IP address in XML
/csv Returns geolocation for the request in CSV
/csv/{ip} Returns geolocation for the requested IP address in CSV

Config

// To save/retrieve locations to/from database
USE_MODEL=false

// To cache locations forever
USE_CACHE=false

// Cache using file or redis
CACHE_DRIVER=file

When using Redis for caching, uncomment RedisServiceProvider in bootstrap/app.php, see this.

Installation

  1. $ git clone https://github.com/emotality/freegeoip-lumen.git
  2. $ cd freegeoip-lumen
  3. $ composer install
  4. $ php artisan geoip:update
  5. $ cp .env.example .env
  6. Open .env and add a generated 32 character long mixed case key to APP_KEY
  7. Configure the rest
  8. $ php artisan migrate if you want to save locations to database

Contributing

Feel free to contribute. Please add as much info as possible and please specify why it is an improvement.

License

freegeoip-lumen is released under the MIT license. See LICENSE for details.

You can’t perform that action at this time.