PHP World Information: Get several types of details of world locations

Recommend this page to a friend!
  Info   Documentation   View files (12)   Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2020-05-28 (2 months ago) Not yet rated by the usersTotal: 110 This week: 1All time: 9,268 This week: 255
Version License PHP version Categories
locatable 1.0.0Custom (specified...7Geography, PHP 7
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
PHP Programming Innovation award nominee
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
Picture of Moamen Eltouny
  Performance   Level  
Name: Moamen Eltouny <contact>
Classes: 11 packages by
Country: Egypt Egypt
Innovation award
Innovation award
Nominee: 5x

Details

[RaggiTech] Laravel-Locatable.

Latest Stable Version Total Downloads License

Locatable provides a quick and easy methods.

Install

Install the latest version using Composer:

$ composer require raggitech/laravel-locatable

Supported Languages

  • Arabic
  • English

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

  Files  
File Role Description
src (1 file, 2 directories)
composer.json Data Auxiliary data
LICENSE Lic. License text
README.md Doc. Documentation

  Files  /  src  
File Role Description
data (4 files)
lang (2 directories)
   Helpers.php Class Functions that get country information from arrays into objects

  Files  /  src  /  data  
File Role Description
   continent.php Aux. Auxiliary script
   country.php Aux. Auxiliary script
   states.php Aux. Auxiliary script
   timezone.php Aux. Auxiliary script

  Files  /  src  /  lang  
File Role Description
ar (3 files)
en (1 file)

  Files  /  src  /  lang  /  ar  
File Role Description
   continent.php Aux. Auxiliary script
   country.php Aux. Auxiliary script
   timezone.php Aux. Auxiliary script

  Files  /  src  /  lang  /  en  
File Role Description
   country.php Aux. Auxiliary script

 Version Control Unique User Downloads Download Rankings  
 100%
Total:110
This week:1
All time:9,268
This week:255

For more information send a message to info at phpclasses dot org.