Last Updated Ratings Unique User Downloads Download Rankings 2020-05-28 (2 months ago) Not yet rated by the users Total: 110 This week: 1 All time: 9,268 This week: 255
Description Author This package can get several types of details of world locations.
It can read PHP configuration files that contain arrays of country information and converts the arrays into objects.
The package provides functions that return several types of details of country information like:
- Get the world time zones
- Get the world continents
- Get the continent of a country
- Get country names
- Get the world countries list
- Get the states of a country
Innovation Award
May 2020
Number 8
Many applications need to use information related with certain countries of the world like the country continent, states, cities and time zones.
This package provides all that information about any country in the world in a way that it does not rely on an external Web service.
Manuel Lemos
Innovation award Nominee: 5x
Details
[RaggiTech] Laravel-Locatable.
Locatable provides a quick and easy methods.
Install
Install the latest version using Composer :
$ composer require raggitech/laravel-locatable
Supported Languages
Usage
<a name="TZ"></a>
TimeZone
function getTimeZones(?string $lang = null)
$timezones = getTimeZones();
/
* ...
* +"Europe/Athens": "(UTC+02:00) Athens"
* +"Europe/Bucharest": "(UTC+02:00) Bucharest"
* +"Africa/Cairo": "(UTC+02:00) Cairo"
* +"Africa/Harare": "(UTC+02:00) Harare"
* +"Europe/Helsinki": "(UTC+02:00) Kyiv"
* +"Europe/Istanbul": "(UTC+02:00) Istanbul"
* +"Asia/Jerusalem": "(UTC+02:00) Jerusalem"
* ...
*/
<a name="Continents"></a>
Continents
function getContinents(?string $lang = null)
function getContinent(string $code, ?string $lang = null)
$continents = getContinents();
/
* +"AF": "Africa"
* +"AN": "Antarctica"
* +"AS": "Asia"
* ...
*/
echo getContinent('AF', 'ar'); // ???????
<a name="Countries"></a>
Countries
function getCountriesNames(?string $lang = null)
function function getCountries(?string $lang = null)
function getCountry(string $code, ?string $lang = null)
$countriesNames = getCountriesNames();
/
* +"AF": "Afghanistan"
* +"AX": "Aland Islands"
* +"AL": "Albania"
* +"DZ": "Algeria"
* +"AS": "American Samoa"
* ...
*/
$countries = getCountries();
/
* ...
* +"EG": array:9 [?
* "iso" => "EGY"
* "name" => "Egypt"
* "native" => "????"
* "currency" => "EGP"
* "phone" => "20"
* "timezone" => "Africa/Cairo"
* "languages" => array:1 [?
* 0 => "AR"
* ]
* "continent" => "AF"
* "capital" => "Cairo"
* ]
* ...
*/
$country = getCountry('EG', 'ar'); // Same result with "name" => "???"
<a name="States"></a>
States
function getStates(?string $country = null)
function getState(string $code, ?string $country = null)
$states = getStates('EG');
/
* +"ALX": "Alexandria Governorate"
* +"ASN": "Aswan Governorate"
* +"AST": "Asyut Governorate"
* .....
*/
echo getStates('ALX', 'EG'); // Alexandria Governorate
License
MIT license
Applications that use this package
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.