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
use PrinsFrank\Standards\Country\CountryAlpha2;
use PrinsFrank\Standards\Country\CountryAlpha3;
use PrinsFrank\Standards\Country\CountryNumeric;
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
CountryAlpha2::Vanuatu->getSubdivisions(); // [CountrySubdivision::Vanuatu_province_Malampa, CountrySubdivision::Vanuatu_province_Penama, CountrySubdivision::Vanuatu_province_Sanma, CountrySubdivision::Vanuatu_province_Shefa, CountrySubdivision::Vanuatu_province_Tafea, CountrySubdivision::Vanuatu_province_Torba]
CountryAlpha2::Aruba->getParentCountry(); // CountryAlpha2::Netherlands
CountryAlpha2::Netherlands->getSubCountries(); // [CountryAlpha2::Aruba, CountryAlpha2::Curacao, CountryAlpha2::Sint_Maarten_Dutch_part, CountryAlpha2::Bonaire_Sint_Eustatius_and_Saba]
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
use PrinsFrank\Standards\Country\CountryAlpha2;
use PrinsFrank\Standards\Country\Groups\EU;
use PrinsFrank\Standards\Country\Groups\Brics;
use PrinsFrank\Standards\Language\LanguageAlpha2;
$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'
use PrinsFrank\Standards\Country\CountryAlpha3;
use PrinsFrank\Standards\Country\Groups\EU;
use PrinsFrank\Standards\Country\Groups\Brics;
use PrinsFrank\Standards\Language\LanguageAlpha2;
$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'
use PrinsFrank\Standards\Country\CountryNumeric;
use PrinsFrank\Standards\Country\Groups\EU;
use PrinsFrank\Standards\Country\Groups\Brics;
use PrinsFrank\Standards\Language\LanguageAlpha2;
$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'
use PrinsFrank\Standards\Http\HttpMethod;
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
use PrinsFrank\Standards\Http\HttpStatusCode;
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
use PrinsFrank\Standards\InternationalCallPrefix\InternationalCallPrefix;
use PrinsFrank\Standards\Country\CountryAlpha2;
use PrinsFrank\Standards\Country\CountryAlpha3;
use PrinsFrank\Standards\Country\CountryName;
use PrinsFrank\Standards\Country\CountryNumeric;
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
use PrinsFrank\Standards\Language\LanguageAlpha2;
use PrinsFrank\Standards\Language\LanguageAlpha3Terminology;
use PrinsFrank\Standards\Language\LanguageAlpha3Extensive;
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
use PrinsFrank\Standards\Country\CountryAlpha2;
use PrinsFrank\Standards\Language\LanguageTag;
use PrinsFrank\Standards\Language\LanguageAlpha2;
use PrinsFrank\Standards\LanguageTag\LanguageTagVariant;
LanguageTag::tryFromString(''); // null
LanguageTag::fromString(); // InvalidArgumentException
LanguageTag::fromString('nl'); // LanguageTag(LanguageAlpha2::Dutch_Flemish);
LanguageTag::fromString('i-enochian'); // LanguageTag(SingleCharacterSubtag::GRANDFATHERED, privateUseSubtag: 'enochian')
LanguageTag::fromString('zh-Hant'); // LanguageTag(LanguageAlpha2::Chinese, script: ScriptSubtag::Han_Traditional_variant)
LanguageTag::fromString('sr-Cyrl'); // LanguageTag(LanguageAlpha2::Serbian, scriptSubtag: ScriptCode::Cyrillic)
LanguageTag::fromString('zh-cmn-Hans-CN'); // LanguageTag(LanguageAlpha2::Chinese, LanguageAlpha3Extensive::Mandarin_Chinese, ScriptCode::Han_Simplified_variant, CountryAlpha2::China)
LanguageTag::fromString('sl-rozaj-biske'); // LanguageTag(LanguageAlpha2::Slovenian, variantSubtag: [LanguageTagVariant::Rezijan, LanguageTagVariant::The_Bila_dialect_of_Resian])
LanguageTag::fromString('de-CH-1901'); // LanguageTag(LanguageAlpha2::German, regionSubtag: CountryAlpha2::Switzerland, variantSubtag: [LanguageTagVariant::Traditional_German_orthography])
LanguageTag::fromString('de-CH-1901')->primaryLanguageSubtag; // LanguageAlpha2::German
LanguageTag::fromString('de-CH-1901')->regionSubtag; // CountryAlpha2::Switzerland
LanguageAlpha2::Dutch_Flemish->toLanguageTag(); // 'nl'
LanguageAlpha2::German->toLanguageTag(regionSubtag: CountryAlpha2::Switzerland, variantSubtag: [LanguageTagVariant::Traditional_German_orthography]); // 'de-CH-1901'
public function foo(LanguageTag $languageTag): {} // Use spec as typehint to enforce valid value
use PrinsFrank\Standards\Region\GeographicRegion;
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
use PrinsFrank\Standards\NationalCallPrefix\NationalCallPrefix;
use PrinsFrank\Standards\Country\CountryAlpha2;
use PrinsFrank\Standards\Country\CountryAlpha3;
use PrinsFrank\Standards\Country\CountryNumeric;
use PrinsFrank\Standards\Country\CountryName;
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
use PrinsFrank\Standards\Scripts\ScriptAlias;
use PrinsFrank\Standards\Scripts\ScriptCode;
use PrinsFrank\Standards\Scripts\ScriptName;
use PrinsFrank\Standards\Scripts\ScriptNumber;
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
use PrinsFrank\Standards\Scripts\ScriptAlias;
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
use PrinsFrank\Standards\Scripts\ScriptCode;
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
use PrinsFrank\Standards\Scripts\ScriptName;
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
use PrinsFrank\Standards\Scripts\ScriptNumber;
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
use PrinsFrank\Standards\TopLevelDomain\CountryCodeTLD;
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
use PrinsFrank\Standards\TopLevelDomain\GenericRestrictedTLD;
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
use PrinsFrank\Standards\TopLevelDomain\GenericTLD;
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
use PrinsFrank\Standards\TopLevelDomain\InfrastructureTLD;
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
use PrinsFrank\Standards\TopLevelDomain\SponsoredTLD;
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
use PrinsFrank\Standards\TopLevelDomain\TestTLD;
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.