Download the PHP package prinsfrank/standards without Composer

On this page you can find all versions of the php package prinsfrank/standards. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package standards

Banner

Standards

GitHub PHP Version Support Packagist Downloads codecov PHPStan Level

A collection of standards as PHP Enums

Daily updated from their sources, whether it is ISO or IANA directly, or a maintaining party like the SIX Group or the US Library of Congress.

Setup

Note Make sure you are running PHP 8.1 or higher to use this package

To start right away, run the following command in your composer project;

Or for development only;

Daily updated from their source

Country Currency HTTP method HTTP Status code Language Language Extensive Script TLD

How this package works

This package implements a bunch of specs as PHP Enums, so you can typehint them in methods. Currently, all specs are implemented as backed enums. That means that besides a name, they have also an internal 'value', either as an integer or a string.

In the Country, Currency and language specifications, there is also a relation between different enums. For example, the Alpha2 country code 'NL' is related to the Alpha3 'NLD', the numeric value '528' and the name 'Netherlands (the)'. Internally, these specs rely on the fact that the keys for these values are identical, so it is possible to convert between these.

Entities and their relations

All specifications in this package are closely related, except for the Http status code and methods. Not all relations are bidirectional though. For example, a language tag is build up of a language and optionally a country, but only a country cannot be converted to a language tag.

Below you can find an overview of all the relationships between specifications.

Upgrading

This package adheres to semver. This means that there are no breaking changes between minor releases (for example from 1.1 to 1.2), but that breaking changes are released as a major release (for example from 1.x to 2.x). To read about upgrading from one major release to the next, please refer to the UPGRADING.md file in the root of this project.

Some powerful use cases

Format a complete phone number string based on the users country;

Automatically select a supported language from an HTTP request;

Listing all country calling codes sorted by country name in a dropdown;

Country (ISO3166-1)

Daily country spec update

:mortar_board: Alpha2/3 country codes are always UPPERCASE to avoid confusion with language codes. It is recommended to use Alpha2/Alpha3 codes when exposing the specification in APIs

At a glance

All the Alpha2, Alpha3, Numeric and Name values have a corresponding enum in the other country enums. These can be converted using their corresponding methods (toAlpha2, toAlpha3 etc...).

Country group membership can be checked by calling the isMemberOf method, supplying the FQN of a class that implements the GroupInterface. Several country groups are available: BRICS, EEA, EFTA etc.

Full documentation ### CountryAlpha2 ### CountryAlpha3 ### CountryNumeric ### CountryName (Deprecated)

Country Calling Codes (ITU-T E.164)

:mortar_board: Country calling codes can be anywhere from 1 to 3 digits, and can span several countries. There are no leading zeros in this specification.

At a glance

Country calling codes are quite straight forward. One country can have multiple country calling codes though, And one country calling code can span multiple countries. That's why the forCountry and getCountriesAlpha2 both return an array of country calling codes/countries and not a single item.

Currency (ISO4217)

Daily currency spec update

:mortar_board: Alpha3 codes are uppercase. When communicating or storing currencies, it is recommended to do so using the Alpha3 or Numeric representation.

At a glance

All the Alpha3, Numeric and Name values have a corresponding enum in the other currency enums. These can be converted using their corresponding methods (toCurrencyAlpha3, etc...). A fourth enum is available that maps all currencies to a currency symbol, that can be accessed by calling the 'getSymbol' method.

Full documentation ### CurrencyAlpha3 ### CurrencyNumeric ### CurrencySymbol ### CurrencyName

HTTP Methods

Daily HTTP method spec update

At a glance

HTTP Status Codes

Daily HTTP Status code spec update

At a glance

International Call Prefixes (ITU-T E.164)

Different countries have different international call prefixes. This is a spec extracted from ITU-T E.164 listing all possible international call prefixes.

At a glance

Language (ISO639)

Daily language spec update Daily Language Extensive update

:mortar_board: Language codes are always in lowercase to avoid confusion with country codes.

:mortar_board: The alpha2 specification has 184 languages, the alpha3 Bibliographic/Terminology specification has 486 languages and the alpha3 Extensive specification has 7908 languages.

:mortar_board: If you have to choose between the alpha3 Bibliographic and Terminology specification, the Terminology specification is more widely used.

At a glance

There are four language code specifications:

As you see, the Bibliographic and Terminology specifications have an identical number of languages, so there is a one-to-one relation between these.

Full documentation ### LanguageAlpha2 (ISO 639-1) ### LanguageAlpha3Bibliographic (ISO 639-2) ### LanguageAlpha3Terminology (ISO 639-2) ### LanguageAlpha3Extensive (ISO 639-3)

Language Tags (RFC 5646)

At a glance

Geographic regions (M49)

:mortar_board: Geographic regions are represented by three digits. Leading zeros are required. Each geographic region can span multiple other geographic regions or countries.

At a glance

National Call Prefixes (ITU-T E.164)

Different countries have different national call prefixes;

At a glance

Scripts

Daily Script spec update

At a glance

Full documentation ### ScriptAlias PHP has regex support for detecting scripts using the following notation: Match any Arabic character Match any NON-Arabic character Not all scripts are supported by PHP regular expressions. An exhaustive list can be found in the [PHP documentation for Unicode character properties](https://www.php.net/manual/en/regexp.reference.unicode.php). For convenience, the information on that page is parsed daily and supplied in this package using the `isSupportedByPHPRegex` method and `SupportedByPHPRegex` attribute which is the underlying information used by the `isSupportedByPHPRegex` method. ### ScriptCode ### ScriptName ### ScriptNumber

TLDs

Daily TLD spec update

There are currently 6 types of Top Level Domains:

Most of these specification have several TLDs that are 'unmanaged' and are thus not currently available. Those are marked as deprecated, but are kept in the specification. There is one exception: All Test TLDs are always unmanaged and are thus never marked as deprecated.

CountryCodeTLD

Where a TLD is marked as unmanaged by IANA it is marked as deprecated.

GenericRestrictedTLD

Where a TLD is marked as unmanaged by IANA it is marked as deprecated.

GenericTLD

Where a TLD is marked as unmanaged by IANA it is marked as deprecated.

InfrastructureTLD

Where a TLD is marked as unmanaged by IANA it is marked as deprecated.

SponsoredTLD

Where a TLD is marked as unmanaged by IANA it is marked as deprecated.

TestTLD

All Test TLDs are always unmanaged and are thus never marked as deprecated.


All versions of standards with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1 || ^8.2 || ^8.3
ext-intl Version *
ext-mbstring Version *
prinsfrank/enums Version ^1.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package prinsfrank/standards contains the following files

Loading the files please wait ....