2017 © Pedro PelĂĄez
 

library world

interact with data from places around the world - the states in the US, the provinces in Canada, validate phone numbers, validate zipcodes/postal codes

image

awoods/world

interact with data from places around the world - the states in the US, the provinces in Canada, validate phone numbers, validate zipcodes/postal codes

  • Thursday, September 28, 2017
  • by awoods
  • Repository
  • 1 Watchers
  • 0 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

World

Make it simple to work with locations and data about the world, (*1)

It should be easy to do things like get a list of US States, Canadian Provinces, and to determine if a postal code or phone number is valid. Some countries don't use postal codes at all, phone numbers have different criteria across countries. This library aims to make things a little easier., (*2)

For every country object, you can access the following information:, (*3)

  • Common Name
  • Official Name
  • ISO 3166-1 alpha 2 code (e.g. US for United States)
  • ISO 3166-2 alpha 3 code (e.g. USA for United States)
  • ISO 4127 Currency code (e.g. USD for United States Dollars)
  • The Continent

The available interfaces are:, (*4)

  • PhoneNumberInterface - provide phone number validation method signatures
  • PostalCodeInterface - provide postal code validation method signatures
  • SubdivisionInterface - provide a subdivision list, e.g. provinces in Canada

The available traits are:, (*5)

  • NorthAmericanPhoneNumber
  • ZipCode

Version

The current version is 0.2.0. This project uses semantic versioning., (*6)

License

This is licensed under the MIT License., (*7)

Example Code

Retrieve Single Country

require 'vendor/autoload.php';

$usa = Awoods\World\CountryFactory::get('US');
echo $usa->getOfficialName(); // Unites States of America

$canada = Awoods\World\CountryFactory::get('CAN');
echo $canada->getCommonName(); // Canada

Loop Over All Countries

require "vendor/autoload.php";

$countryFactory = new \Awoods\World\CountryFactory();
$countries = $countryFactory->getAllCountries();

foreach ($countries AS $code => $name) {
    echo "\n";
    echo "{$code} is the code for {$name}\n";

    $country = $countryFactory->create($code);

    echo "The official name for {$name} is '{$country->getFullName()}'\n";
    echo "Here is a list of it's localities:\n";

    foreach ($country->getLocalityList() AS $localityCode => $localityName) {
        echo "* {$localityName} ({$localityCode})\n";
    }
}
echo "\n";

Currently Supported Countries

North America

The countries have additional phone number and postal code validation methods, (*8)

  • United States
  • Canada
  • Mexico

The countries have basic Country support, (*9)

  • Anguilla
  • Antigua and Barbuda
  • Aruba
  • Bahamas
  • Barbados
  • Belize
  • Bermuda
  • British Virgin Islands
  • Caribbean Netherlands
  • Cayman Islands
  • Costa Rica
  • Cuba
  • Curaçao
  • Dominica
  • Dominican Republic
  • El Salvador
  • Greenland
  • Grenada
  • Guadeloupe
  • Guatemala
  • Haiti
  • Honduras
  • Jamaica
  • Martinique
  • Montserrat
  • Nicaragua
  • Panama
  • Puerto Rico
  • Sint Maarten
  • St. BarthĂ©lemy
  • St. Kitts and Nevis
  • St. Lucia
  • St. Martin
  • St. Pierre and Miquelon
  • St. Vincent and Grenadines
  • Trinidad and Tobago
  • Turks and Caicos Islands
  • U.S. Virgin Islands

Upcoming Countries

  • South America, (*10)

    • todo
  • Europe, (*11)

    • todo
  • Asia, (*12)

    • todo
  • Africa, (*13)

    • todo
  • Oceania, (*14)

    • todo
  • Antarctica, (*15)

    • todo

Ideas for sections/pages

  • Traits, (*16)

    • NorthAmericanPhoneNumber
  • Features, (*17)

  • Language Translations, (*18)

    These 5 languages plus English should cover most developers in the world, (*19)

    • Spanish
    • French
    • Hindi
    • Chinese (Mandarin)
    • Arabic
  • Frequently Asked Questions (FAQ), (*20)

  • Screenshots
  • Submit Issues

Credits and Acknowledgments

The Versions

28/09 2017

dev-master

9999999-dev

interact with data from places around the world - the states in the US, the provinces in Canada, validate phone numbers, validate zipcodes/postal codes

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andrew Woods

geography phone numbers locations postal codes zipcodes

28/09 2017

dev-dev

dev-dev

interact with data from places around the world - the states in the US, the provinces in Canada, validate phone numbers, validate zipcodes/postal codes

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andrew Woods

geography phone numbers locations postal codes zipcodes

28/09 2017

0.1.1

0.1.1.0

interact with data from places around the world - the states in the US, the provinces in Canada, validate phone numbers, validate zipcodes/postal codes

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andrew Woods

geography phone numbers locations postal codes zipcodes

27/09 2017

0.1.0

0.1.0.0

interact with data from places around the world - the states in the US, the provinces in Canada, validate phone numbers, validate zipcodes/postal codes

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andrew Woods

geography phone numbers locations postal codes zipcodes