brocard / geonames by brocard

Set a geolocation tables for any projects
84
1
3
Package Data
Maintainer Username: brocard
Maintainer Contact: brocard@gmail.com (Yusniel Brocard)
Package Create Date: 2015-02-10
Package Last Update: 2017-07-07
Home Page: https://brocard.github.io/geonames/
Language: PHP
License: MIT
Last Refreshed: 2024-04-26 03:23:04
Package Statistics
Total Downloads: 84
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 1
Total Watchers: 3
Total Forks: 0
Total Open Issues: 0

Library to fetch data from geonames.org

Latest Version on Packagist GitHub license Total Downloads StyleCI

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