rinvex / universities

Rinvex University is a simple and lightweight package for retrieving university details with flexibility. A whole bunch of data including name, country, state, email, website, telephone, address, and much more attributes for the 17k+ known universities worldwide at your fingertips.
MIT License
62 stars 25 forks source link

Return null #12

Closed emresaracoglu closed 3 years ago

emresaracoglu commented 5 years ago

Hello

Thank you for this project.

I just want to print the universities in Turkey but coming up empty.

     include "vendor/autoload.php";  

$Universities = universities('tr');

 print_r($Universities);

What is the problem? Thank yo again

ScSherifTarek commented 5 years ago

Hello @emresaracoglu I think that because the names.json file didn't change to use the countries code the country name will do the work for now. you can use this universities('turkey')

ScSherifTarek commented 5 years ago

You can use Locale class to get the country name then pass the country name instead of the country code that works for most of the countries but countries like "Côte d'Ivoire" are named here in English so this solution will not work for all the countries but it can for some. This line of code will do that \Locale::getDisplayRegion('-'.$countryCode, 'en').

I think a file maps between the country code and its name here will do the work.

Omranic commented 3 years ago

Thank you @ScSherifTarek for pointing the correct answer for the current release.

@emresaracoglu In the future I'm planning to change the behavior of this package to use country ISO codes, PRs are welcome :)