I've just released a new package igaster/laravel_cities that wraps geoname.org database (ex MaxCDN). You can deploy your DB localy and query for any city on the world (or limit to a specific country)
A short example:
// Get the States of USA in aplhabetic order
geo::getCountry('US')
->children()
->orderBy('name')
->get();
// Get the 3 biggest cities of Greece
geo::getCountry('GR')
->level(geo::LEVEL_3)
->orderBy('population','DESC')
->limit(3)
->get();
What you get:
Deploy and use geonames.org (ex MaxCDN) database localy to query countries/citiew
Get information like lattitude/longtityde, population etc
Your package has mixed casing (snake & camel casing).
I wouldn't use this package for various reasons, but first and foremost this doesn't look pretty and align with Laravel's design (or PSR). For example:
use igaster\laravel_cities\geo;
Should be:
use Igaster\LaravelCities\Geo;
Geo::getCountry('GR');
Some other issues:
Tons of raw SQL in your parseGeoFile.php (shouldn't need this, Laravel has a built in ORM)
@stevenbauman Thank you for reviewing. I've released a new version with Laravel coding styles applied as you recomended. Now it is:
use Igaster\LaravelCities\Geo;
In fact I started this package while experimenting with various geo-providers. I decided to ship it as a Package when I saw that I couldn't find this functionality on Laravel. This is the reason that the Seeder is written in plain PHP. My aim was to provide an efficient way to query geographical data in a tree-like structure.
For exapmle when the user selects a country (eg with select2.js) you can dynamically load the provinces and then the cities step-by-step.
Maybe I will release some vue templates that plug with the API to provide a complete solution.