Simple project showing how to load GeoLite Country IP list from CSV file into a Restful API database and match IP and Country respectively throught GET endpoint, also make automated tests.
- Clone the repository with git clone
- Create a DB called 'geolite'
- Copy .env.example file to .env and edit database credentials there
- Run composer install
- Run php artisan key:generate
- Run php artisan migrate
- Run php artisan db:seed to Load CSV file and fill table countries
- Run php artisan serve to Run Built-in web server
- That's it - Try api GET endpoint on localhost:8000/api/locationByIP?IP=127.0.0.1 (Change for the IP you want to)
Please use and re-use however you want.