PHP Classes

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

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 124 All time: 9,456 This week: 560Up
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: 38 packages by
Country: Egypt Egypt
Age: 31
All time rank: 257626 in Egypt Egypt
Week rank: 206 Up3 in Egypt Egypt Up
Innovation award
Innovation award
Nominee: 22x

Documentation

[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 folder image Files (12)  
File Role Description
Files folder imagesrc (1 file, 2 directories)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (12)  /  src  
File Role Description
Files folder imagedata (4 files)
Files folder imagelang (2 directories)
  Plain text file Helpers.php Class Functions that get country information from arrays into objects

  Files folder image Files (12)  /  src  /  data  
File Role Description
  Accessible without login Plain text file continent.php Aux. Auxiliary script
  Accessible without login Plain text file country.php Aux. Auxiliary script
  Accessible without login Plain text file states.php Aux. Auxiliary script
  Accessible without login Plain text file timezone.php Aux. Auxiliary script

  Files folder image Files (12)  /  src  /  lang  
File Role Description
Files folder imagear (3 files)
Files folder imageen (1 file)

  Files folder image Files (12)  /  src  /  lang  /  ar  
File Role Description
  Accessible without login Plain text file continent.php Aux. Auxiliary script
  Accessible without login Plain text file country.php Aux. Auxiliary script
  Accessible without login Plain text file timezone.php Aux. Auxiliary script

  Files folder image Files (12)  /  src  /  lang  /  en  
File Role Description
  Accessible without login Plain text file country.php Aux. Auxiliary script

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:124
This week:0
All time:9,456
This week:560Up