rinvex / countries

Rinvex Country is a simple and lightweight package for retrieving country details with flexibility. A whole bunch of data including name, demonym, capital, iso codes, dialling codes, geo data, currencies, flags, emoji, and other attributes for all 250 countries worldwide at your fingertips.
https://rinvex.com
MIT License
1.65k stars 206 forks source link

[proposal] add population data #185

Closed thekonz closed 2 years ago

thekonz commented 3 years ago

I think it would be nice to have a rough estimate of how many people live in a country. The official numbers change every now and then, but they are usually pretty stable. Updating once or twice a year would suffice imho.

Data source: https://data.worldbank.org/indicator/SP.POP.TOTL It has a csv download.

$germany = country('de');

// 83132799
$germany->getPopulation();

// additionally we could use the data to enable this:
// 81776930
$germany->getPopulationAtYear(2010);
Omranic commented 3 years ago

Thank you @thekonz for this great proposal, would you be able to submit a PR for that?

thekonz commented 3 years ago

Maybe in a few weeks. Currently a bit busy^^

Omranic commented 3 years ago

Happy to consider PRs for this from anyone interested 🙃

thekonz commented 3 years ago

So do I get this right, that there is not really any way of automated data fetching right now? All I see is tons of json files. Are people supposed to edit them in order to add features/data to this package?

Omranic commented 2 years ago

Closing for inactivity, I'll be happy to consider PRs adding this feature, all PRs are welcome 😉

Country data are supposed to be pretty stable, so it's not common to expect people to edit this package to add features. And no, there's currently no automated data fetching as this is a standalone package, with all data static included in files, and you can use it the way you want. If you've ideas to make it better, I'd be happy to consider PRs, all PRs are welcome.