1. Go to this page and download the library: Download prinsfrank/standards library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
prinsfrank / standards example snippets
CountryAlpha2::from('NL'); // CountryAlpha2::Netherlands
CountryNumeric::from('528'); // CountryNumeric::Netherlands
CountryNumeric::fromInt(528); // CountryNumeric::Netherlands
CountryAlpha3::from('NLD'); // CountryAlpha3::Netherlands
CountryAlpha3::from('NLD')->value; // 'NLD'
CountryAlpha3::from('NLD')->name; // 'Netherlands'
CountryAlpha3::from('NLD')->toCountryAlpha2()->value; // 'NL'
CountryAlpha3::from('NLD')->toCountryNumeric()->value; // '528'
CountryAlpha3::from('NLD')->toCountryNumeric()->valueAsInt(); // 528
CountryAlpha3::from('NLD')->isMemberOf(EU::class); // true
CountryAlpha2::Netherlands; // CountryAlpha2::Netherlands
CountryAlpha3::from('NLD')->getCountryCallingCodes(); // [CountryCallingCode::Netherlands_Kingdom_of_the]
CountryAlpha3::from('NLD')->getCountryCallingCodes()[0]->value; // 31
CountryAlpha3::from('NLD')->getInternationalCallPrefix(); // InternationalCallPrefix::_00
CountryAlpha3::from('NLD')->getInternationalCallPrefix()->value; // '00'
CountryAlpha3::from('NLD')->getNationalCallPrefix(); // NationalCallPrefix::_0
CountryAlpha3::from('NLD')->getNationalCallPrefix()->value; // '0'
CountryAlpha3::from('NLD')->getFlagEmoji(); // '🇳🇱' (This might not be displayed correctly in this readme if you're on windows, see 'https://prinsfrank.nl/2021/01/25/Non-existing-flag-emojis-on-windows to make these flag emojis visible for Windows users.')
CountryAlpha3::from('NLD')->getCurrenciesAlpha3(); // [CurrencyAlpha3::Euro]
CountryAlpha3::from('NLD')->getOfficialAndDeFactoLanguages(); // [LanguageAlpha2::Dutch_Flemish]
CountryAlpha3::from('NLD')->getNameInLanguage(LanguageAlpha2::Dutch_Flemish): // 'Nederland'
CountryAlpha3::from('NLD')->getNameInLanguage(LanguageAlpha2::English): // 'Netherlands'
CountryAlpha3::from('NLD')->formatNumber(42.42, LanguageAlpha2::Dutch_Flemish); // '42,42'
public function foo(CountryAlpha2 $countryAlpha2) {} // Use spec as typehint to enforce valid value
$valueAlpha2 = CountryAlpha2::from('NL'); // CountryAlpha2::Netherlands
$value = $valueAlpha2->value; // 'NL'
$lowerCaseValue = $valueAlpha2->lowerCaseValue(); // 'nl'
$valueName = $valueAlpha2->name; // 'Netherlands'
$valueAlpha3 = $valueAlpha2->toCountryAlpha3(); // CountryAlpha3::Netherlands
$valueNumeric = $valueAlpha2->toCountryNumeric(); // CountryNumeric::Netherlands
$isMemberOfEu = $valueAlpha2->isMemberOf(EU::class); // true
$isMemberOfBrics = $valueAlpha2->isMemberOf(Brics::class); // false
$valueAlpha2->getCountryCallingCodes(); // [CountryCallingCode::Netherlands_Kingdom_of_the]
$valueAlpha2->getCountryCallingCodes()[0]->value; // 31
$valueAlpha2->getInternationalCallPrefix(); // InternationalCallPrefix::_00
$valueAlpha2->getInternationalCallPrefix()->value; // '00'
$valueAlpha2->getNationalCallPrefix(); // NationalCallPrefix::_0
$valueAlpha2->getNationalCallPrefix()->value; // '0'
$valueAlpha2::from('NL')->getFlagEmoji(); // '🇳🇱' (This might not be displayed correctly in this readme if you're on windows, see 'https://prinsfrank.nl/2021/01/25/Non-existing-flag-emojis-on-windows to make these flag emojis visible for Windows users.')
$valueAlpha2->getCurrenciesAlpha3(); // [CurrencyAlpha3::Euro]
$valueAlpha2->getOfficialAndDeFactoLanguages(); // [LanguageAlpha2::Dutch_Flemish]
$valueAlpha2->getNameInLanguage(LanguageAlpha2::Dutch_Flemish): // 'Nederland'
$valueAlpha2->getNameInLanguage(LanguageAlpha2::English): // 'Netherlands'
$valueAlpha2->formatNumber(42.42, LanguageAlpha2::Dutch_Flemish); // '42,42'
$valueAlpha3 = CountryAlpha3::from('NLD'); // CountryAlpha3::Netherlands
$value = $valueAlpha3->value; // 'NLD'
$valueName = $valueAlpha3->name; // 'Netherlands'
$valueAlpha2 = $valueAlpha3->toCountryAlpha2(); // CountryAlpha2::Netherlands
$valueNumeric = $valueAlpha3->toCountryNumeric(); // CountryNumeric::Netherlands
$isMemberOfEu = $valueAlpha3->isMemberOf(EU::class); // true
$isMemberOfBrics = $valueAlpha3->isMemberOf(Brics::class); // false
$valueAlpha3->getCountryCallingCodes(); // [CountryCallingCode::Netherlands_Kingdom_of_the]
$valueAlpha3->getCountryCallingCodes()[0]->value; // 31
$valueAlpha3->getInternationalCallPrefix(); // InternationalCallPrefix::_00
$valueAlpha3->getInternationalCallPrefix()->value; // '00'
$valueAlpha3->getNationalCallPrefix(); // NationalCallPrefix::_0
$valueAlpha3->getNationalCallPrefix()->value; // '0'
$valueAlpha3->getFlagEmoji(); // '🇳🇱' (This might not be displayed correctly in this readme if you're on windows, see 'https://prinsfrank.nl/2021/01/25/Non-existing-flag-emojis-on-windows to make these flag emojis visible for Windows users.')
$valueAlpha3->getCurrenciesAlpha3(); // [CurrencyAlpha3::Euro]
$valueAlpha3->getOfficialAndDeFactoLanguages(); // [LanguageAlpha2::Dutch_Flemish]
$valueAlpha3->getNameInLanguage(LanguageAlpha2::Dutch_Flemish): // 'Nederland'
$valueAlpha3->getNameInLanguage(LanguageAlpha2::English): // 'Netherlands'
$valueAlpha2->formatNumber(42.42, LanguageAlpha2::Dutch_Flemish); // '42,42'
$valueNumeric = CountryNumeric::from('528'); // CountryNumeric::Netherlands
$valueNumeric = CountryNumeric::fromInt(528); // CountryNumeric::Netherlands
$value = $valueNumeric->value; // '528'
$valueName = $valueNumeric->name; // 'Netherlands'
$valueAlpha2 = $valueNumeric->toCountryAlpha2(); // CountryAlpha2::Netherlands
$valueAlpha3 = $valueNumeric->toCountryAlpha3(); // CountryAlpha3::Netherlands
$isMemberOfEu = $valueNumeric->isMemberOf(EU::class); // true
$isMemberOfBrics = $valueNumeric->isMemberOf(Brics::class); // false
$valueNumeric->getCountryCallingCodes(); // [CountryCallingCode::Netherlands_Kingdom_of_the]
$valueNumeric->getCountryCallingCodes()[0]->value; // 31
$valueNumeric->getInternationalCallPrefix(); // InternationalCallPrefix::_00
$valueNumeric->getInternationalCallPrefix()->value; // '00'
$valueNumeric->getNationalCallPrefix(); // NationalCallPrefix::_0
$valueNumeric->getNationalCallPrefix()->value; // '0'
$valueNumeric->getFlagEmoji(); // '🇳🇱' (This might not be displayed correctly in this readme if you're on windows, see 'https://prinsfrank.nl/2021/01/25/Non-existing-flag-emojis-on-windows to make these flag emojis visible for Windows users.')
$valueNumeric->getCurrenciesAlpha3(); // [CurrencyAlpha3::Euro]
$valueNumeric->getOfficialAndDeFactoLanguages(); // [LanguageAlpha2::Dutch_Flemish]
$valueNumeric->getNameInLanguage(LanguageAlpha2::Dutch_Flemish): // 'Nederland'
$valueNumeric->getNameInLanguage(LanguageAlpha2::English): // 'Netherlands'
$valueAlpha2->formatNumber(42.42, LanguageAlpha2::Dutch_Flemish); // '42,42'
$valueName = CountryName::from('Netherlands (Kingdom of the)'); // CountryName::Netherlands
$value = $valueName->value; // 'Netherlands (Kingdom of the)'
$valueName = $valueName->name; // 'Netherlands'
$valueAlpha2 = $valueName->toCountryAlpha2(); // CountryAlpha2::Netherlands
$valueAlpha3 = $valueName->toCountryAlpha3(); // CountryAlpha3::Netherlands
$valueNumeric = $valueName->toCountryNumeric(); // CountryNumeric::Netherlands
$isMemberOfEu = $valueName->isMemberOf(EU::class); // true
$isMemberOfBrics = $valueName->isMemberOf(Brics::class); // false
$valueName->getCountryCallingCodes(); // [CountryCallingCode::Netherlands_Kingdom_of_the]
$valueName->getCountryCallingCodes()[0]->value; // 31
$valueName->getInternationalCallPrefix(); // InternationalCallPrefix::_00
$valueName->getInternationalCallPrefix()->value; // '00'
$valueName->getNationalCallPrefix(); // NationalCallPrefix::_0
$valueName->getNationalCallPrefix()->value; // '0'
$valueName->getFlagEmoji(); // '🇳🇱' (This might not be displayed correctly in this readme if you're on windows, see 'https://prinsfrank.nl/2021/01/25/Non-existing-flag-emojis-on-windows to make these flag emojis visible for Windows users.')
$valueName->getCurrenciesAlpha3(); // [CurrencyAlpha3::Euro]
$valueName->getOfficialAndDeFactoLanguages(); // [LanguageAlpha2::Dutch_Flemish]
CountryCallingCode::from(1); // CountryCallingCode::Integrated_numbering_plan
CountryCallingCode::from(31); // CountryCallingCode::Netherlands_Kingdom_of_the
CountryCallingCode::from(31)->value; // 31
CountryCallingCode::from(31)->name; // 'Netherlands_Kingdom_of_the'
CountryCallingCode::Netherlands_Kingdom_of_the; // CountryCallingCode::Netherlands_Kingdom_of_the
CountryCallingCode::from(31)->getCountriesAlpha2(); // [CountryAlpha2::Netherlands]
CountryCallingCode::from(7)->getCountriesAlpha2(); // [CountryAlpha2::Kazakhstan, CountryAlpha2::Russian_Federation]
CountryCallingCode::forCountry(CountryAlpha2::Netherlands); // [CountryCallingCode::Netherlands_Kingdom_of_the]
public function foo(CountryCallingCode $countryCallingCode) {} // Use spec as typehint to enforce valid value
HttpMethod::from('POST'); // HttpMethod::Post
HttpMethod::from('POST')->value; // 'POST'
HttpMethod::from('POST')->name; // Post
HttpMethod::Post; // HttpMethod::Post
public function foo(HttpMethod $httpMethod) {} // Use spec as typehint to enforce valid value
HttpStatusCode::from(404); // HttpStatusCode::Not_Found
HttpStatusCode::from(404->value; // 404
HttpStatusCode::from(404->name; // Not_Found
HttpStatusCode::Not_Found; // HttpStatusCode::Not_Found
public function foo(HttpStatusCode $httpStatusCode) {} // Use spec as typehint to enforce valid value
InternationalCallPrefix::from('0'); // InternationalCallPrefix::_0
InternationalCallPrefix::from('0')->value; // '0'
InternationalCallPrefix::from('0')->name; // '_0'
InternationalCallPrefix::_0; // InternationalCallPrefix::_0
InternationalCallPrefix::_0->getCountriesAlpha2(); // [CountryAlpha2::Samoa]
InternationalCallPrefix::forCountry(CountryAlpha2::Netherlands); // InternationalCallPrefix::_00
InternationalCallPrefix::forCountry(CountryAlpha3::Netherlands); // InternationalCallPrefix::_00
InternationalCallPrefix::forCountry(CountryNumeric::Netherlands); // InternationalCallPrefix::_00
InternationalCallPrefix::forCountry(CountryName::Netherlands); // InternationalCallPrefix::_00
public function foo(InternationalCallPrefix $internationalCallPrefix) {} // Use spec as typehint to enforce valid value
LanguageAlpha2::from('nl'); // LanguageAlpha2::Dutch_Flemish
LanguageAlpha2::from('nl')->value; // 'nl'
LanguageAlpha2::from('nl')->name; // 'Dutch_Flemish'
LanguageAlpha2::from('nl')->toLanguageAlpha3Bibliographic(); // LanguageAlpha3Bibliographic::Dutch_Flemish
LanguageAlpha2::from('nl')->toLanguageAlpha3Bibliographic()->value; // 'dut'
LanguageAlpha2::from('nl')->toLanguageAlpha3Terminology(); // LanguageAlpha3Terminology::Dutch_Flemish
LanguageAlpha2::from('nl')->toLanguageAlpha3Terminology()->value; // 'nld'
LanguageAlpha2::from('nl')->toLanguageName()->value; // 'Dutch; Flemish'
LanguageAlpha3Terminology::from('nld'); // LanguageAlpha3Terminology::Dutch_Flemish
LanguageAlpha3Bibliographic::from('dut'); // LanguageAlpha3Bibliographic::Dutch_Flemish
LanguageAlpha3Extensive::from('nld'); // LanguageAlpha3Extensive::Dutch
LanguageAlpha3Extensive::from('dse'); // LanguageAlpha3Extensive::Dutch_Sign_Language
LanguageAlpha2::Dutch_Flemish->getNameInLanguage(LanguageAlpha2::Dutch_Flemish); // 'Nederlands'
LanguageAlpha2::Dutch_Flemish->getNameInLanguage(LanguageAlpha2::English); // 'Dutch'
public function foo(LanguageAlpha2 $languageAlpha2); // Use spec as typehint to enforce valid value
GeographicRegion::from('150'); // GeographicRegion::Europe
GeographicRegion::from('150')->value; // '150'
GeographicRegion::from('150')->name; // Europe
GeographicRegion::Europe; // GeographicRegion::Europe
GeographicRegion::from('150')->getDirectSubRegions(); // [GeographicRegion::Eastern_Europe, GeographicRegion::Northern_Europe, ...]
GeographicRegion::from('150')->getAllSubRegions(); // [GeographicRegion::Eastern_Europe, GeographicRegion::Northern_Europe, ...]
GeographicRegion::from('150')->getDirectSubCountries(); // []
GeographicRegion::from('150')->getAllSubCountries(); // [CountryNumeric::Belarus, CountryNumeric::Bulgaria, ...]
public function foo(GeographicRegion $geographicRegion) {} // Use spec as typehint to enforce valid value
NationalCallPrefix::from('0'); // NationalCallPrefix::_0
NationalCallPrefix::from('0')->value; // '0'
NationalCallPrefix::from('0')->name; // '_0'
NationalCallPrefix::_0; // NationalCallPrefix::_0
NationalCallPrefix::forCountry(CountryAlpha2::Netherlands); // NationalCallPrefix::_0
NationalCallPrefix::forCountry(CountryAlpha3::Netherlands); // NationalCallPrefix::_0
NationalCallPrefix::forCountry(CountryNumeric::Netherlands); // NationalCallPrefix::_0
NationalCallPrefix::forCountry(CountryName::Netherlands); // NationalCallPrefix::_0
public function foo(NationalCallPrefix $nationalCallPrefix) {} // Use spec as typehint to enforce valid value
ScriptAlias::from('Latin'); // ScriptAlias::Latin
ScriptAlias::from('Latin')->value; // 'Latin'
ScriptAlias::from('Latin')->name; // 'Latin'
ScriptAlias::Latin; // ScriptAlias::Latin
ScriptAlias::from('Latin')->toScriptCode(); // ScriptCode::Latin
ScriptCode::from('Latn'); // ScriptCode::Latin
ScriptName::from('Latin'); // ScriptName::Latin
ScriptNumber::from('215'); // ScriptNumber::Latin
ScriptAlias::Latin->isSupportedByPHPRegex(); // true
ScriptAlias::allForString('еюeuеюευ'); // [ScriptAlias::Cyrillic, ScriptAlias::Greek, ScriptAlias::Latin]
ScriptAlias::hasMultipleForString('еюeuеюευ'); // true
ScriptAlias::mostCommonInString('еюeuеюευ'); // ScriptAlias::Cyrillic
public function foo(ScriptAlias $scriptAlias) {} // Use spec as typehint to enforce valid value
ScriptAlias::from('Latin'); // ScriptAlias::latin
ScriptAlias::from('Latin')->value; // 'Latin'
ScriptAlias::from('Latin')->name; // 'Latin'
ScriptAlias::from('Latin')->toScriptCode(); // ScriptCode::Latin
ScriptAlias::from('Latin')->toScriptName(); // ScriptName::Latin
ScriptAlias::from('Latin')->toScriptNumber(); // ScriptNumber::Latin
ScriptAlias::Latin; // ScriptAlias::Latin
ScriptAlias::from('Latin')->isSupportedByPHPRegex(); // true
ScriptAlias::allForString('еюeuеюευ'); // [ScriptAlias::Cyrillic, ScriptAlias::Greek, ScriptAlias::Latin]
ScriptAlias::hasMultipleForString('еюeuеюευ'); // true
ScriptAlias::mostCommonInString('еюeuеюευ'); // ScriptAlias::Cyrillic
public function foo(ScriptAlias $scriptAlias) {} // Use spec as typehint to enforce valid value
ScriptCode::from('Latn'); // ScriptCode::latin
ScriptCode::from('Latn')->value; // 'Latin'
ScriptCode::from('Latn')->name; // 'Latin'
ScriptCode::from('Latn')->toScriptAlias(); // ScriptAlias::Latin
ScriptCode::from('Latn')->toScriptName(); // ScriptName::Latin
ScriptCode::from('Latn')->toScriptNumber(); // ScriptNumber::Latin
ScriptCode::Latin; // ScriptCode::Latin
ScriptCode::allForString('еюeuеюευ'); // [ScriptCode::Cyrillic, ScriptCode::Greek, ScriptCode::Latin]
ScriptCode::hasMultipleForString('еюeuеюευ'); // true
ScriptCode::mostCommonInString('еюeuеюευ'); // ScriptCode::Cyrillic
public function foo(ScriptCode $scriptCode) {} // Use spec as typehint to enforce valid value
ScriptName::from('Latin'); // ScriptName::latin
ScriptName::from('Latin')->value; // 'Latin'
ScriptName::from('Latin')->name; // 'Latin'
ScriptName::from('Latin')->toScriptCode(); // ScriptCode::Latin
ScriptName::from('Latin')->toScriptAlias(); // ScriptAlias::Latin
ScriptName::from('Latin')->toScriptNumber(); // ScriptNumber::Latin
ScriptName::Latin; // ScriptName::Latin
ScriptName::allForString('еюeuеюευ'); // [ScriptName::Cyrillic, ScriptName::Greek, ScriptName::Latin]
ScriptName::hasMultipleForString('еюeuеюευ'); // true
ScriptName::mostCommonInString('еюeuеюευ'); // ScriptName::Cyrillic
public function foo(ScriptName $scriptName) {} // Use spec as typehint to enforce valid value
ScriptNumber::from('215'); // ScriptNumber::latin
ScriptNumber::from('215')->value; // 'Latin'
ScriptNumber::from('215')->name; // 'Latin'
ScriptNumber::from('215')->toScriptCode(); // ScriptCode::Latin
ScriptNumber::from('215')->toScriptName(); // ScriptName::Latin
ScriptNumber::from('215')->toScriptAlias(); // ScriptAlias::Latin
ScriptNumber::Latin; // ScriptNumber::Latin
ScriptNumber::allForString('еюeuеюευ'); // [ScriptNumber::Cyrillic, ScriptAlias::Greek, ScriptAlias::Latin]
ScriptNumber::hasMultipleForString('еюeuеюευ'); // true
ScriptNumber::mostCommonInString('еюeuеюευ'); // ScriptNumber::Cyrillic
public function foo(ScriptNumber $scriptNumber) {} // Use spec as typehint to enforce valid value
CountryCodeTLD::from('nl'); // CountryCodeTLD::nl
CountryCodeTLD::nl; // CountryCodeTLD::nl
CountryCodeTLD::from('nl')->value; // 'nl'
CountryCodeTLD::from('nl')->name; // 'nl'
CountryCodeTLD::from('nl')->isAssigned(); // true
CountryCodeTLD::from('nl')->getCountryAlpha2(); // CountryAlpha2::Netherlands
CountryCodeTLD::from('nl')->getCountryAlpha3(); // CountryAlpha3::Netherlands
CountryCodeTLD::from('nl')->getCountryNumeric(); // CountryNumeric::Netherlands
public function foo(CountryCodeTLD $countryCodeTLD) {} // Use spec as typehint to enforce valid value
GenericRestrictedTLD::from('name'); // GenericRestrictedTLD::name
GenericRestrictedTLD::name; // GenericRestrictedTLD::name
GenericRestrictedTLD::from('name')->value; // 'name'
GenericRestrictedTLD::from('name')->name; // 'name'
GenericRestrictedTLD::from('name')->isAssigned(); // true
public function foo(GenericRestrictedTLD $genericRestrictedTLD) {} // Use spec as typehint to enforce valid value
GenericTLD::from('aaa'); // GenericTLD::aaa
GenericTLD::aaa; // GenericTLD::aaa
GenericTLD::from('aaa')->value; // 'aaa'
GenericTLD::from('aaa')->name; // 'aaa'
GenericTLD::from('aaa')->isAssigned(); // true
public function foo(GenericTLD $genericTLD) {} // Use spec as typehint to enforce valid value
InfrastructureTLD::from('arpa'); // InfrastructureTLD::arpa
InfrastructureTLD::arpa; // InfrastructureTLD::arpa
InfrastructureTLD::from('arpa')->value; // 'arpa'
InfrastructureTLD::from('arpa')->name; // 'arpa'
InfrastructureTLD::from('arpa')->isAssigned(); // true
public function foo(InfrastructureTLD $infrastructureTLD) {} // Use spec as typehint to enforce valid value
SponsoredTLD::from('aero'); // SponsoredTLD::aero
SponsoredTLD::arpa; // SponsoredTLD::aero
SponsoredTLD::from('aero')->value; // 'aero'
SponsoredTLD::from('aero')->name; // 'aero'
SponsoredTLD::from('aero')->isAssigned(); // true
public function foo(SponsoredTLD $sponsoredTLD) {} // Use spec as typehint to enforce valid value
TestTLD::from('テスト'); // TestTLD::tesuto_katakana
TestTLD::tesuto_katakana; // TestTLD::tesuto_katakana
TestTLD::from('テスト')->value; // 'テスト'
TestTLD::from('テスト')->name; // 'tesuto_katakana'
TestTLD::from('テスト')->isAssigned() // false
public function foo(TestTLD $testTLD) {} // Use spec as typehint to enforce valid value
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.