brocard/geolocation is a Laravel package for set a geolocation tables for any projects.
It currently has 1 GitHub stars and 88 downloads on Packagist (latest version v0.4).
Install it with composer require brocard/geolocation.
Discover more Laravel packages by brocard
or browse all Laravel packages to compare alternatives.
Last updated
Add the Geoname service provider to the config/app.php file in the providers array:
'providers' => [
// Laravel Framework Service Providers...
//...
// Package Service Providers
BrocardJr\Geo\GeoServiceProvider::class,
// ...
// Application Service Providers
// ...
],
For first instance you only need set enviroment variable intro .env file in root directoy
example: GEONAMES_USERNAME=your_username
You may easily access your configuration values using the global config helper function only run the next artisan command
php artisan vendor:publish --provider="BrocardJr\Geo\GeoServiceProvider"
Reload de config for some changes
php artisan vendor:publish --provider="BrocardJr\Geo\GeoServiceProvider" --tag=config --force
Install migrations
php artisan geo:install
Get countries from api.geonames.org
php artisan geo:import-countries
Get states from api.geonames.org
php artisan geo:import-states