Download the PHP package tiny-blocks/country without Composer

On this page you can find all versions of the php package tiny-blocks/country. 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 country

Country

License

Overview

Provides ISO 3166-1 country and ISO 3166-2 subdivision value objects for PHP. A Country is a lazy handle over an Alpha-2 code that resolves its name, its Alpha-3 and numeric codes, its IANA timezones, and its subdivisions on demand. A Subdivision is the same kind of handle one level down, resolving its name, its category, and its owning country from the ISO 3166-2 code.

Construction works from any of the three code variants (Alpha-2, Alpha-3, or numeric), with automatic conversion between them. The data is generated from the ISO 3166 standard. Names are the official ISO English short names, so the values are stable and citable rather than derived. The library builds on the tiny-blocks value-object contract for immutability and structural equality, on tiny-blocks/time for timezones, and on tiny-blocks/collection for the country and subdivision collections.

Installation

How to use

Country codes

Each country has three ISO 3166-1 representations: a two-letter Alpha2Code, a three-letter Alpha3Code, and a three-digit NumericCode. Every code converts to the other two and to its string value.

The numeric code keeps the ISO leading zeros as a string and exposes them as an integer through toInteger.

Country

A Country can be created from any code object with from, or from a string with fromString. The name, both alpha codes, the numeric code, the timezones, and the subdivisions are read through methods.

Creating from objects

The same country is produced from its Alpha-3 or numeric code, since from canonicalizes to the Alpha-2 code.

Creating from string

fromString accepts an Alpha-2, Alpha-3, or numeric code as a string. It throws InvalidCountryCode when the string matches no known code.

Safe creation

Use tryFromString to validate external input without handling exceptions. It returns null when the code matches no known Alpha-2, Alpha-3, or numeric code.

Subdivisions

Each Country exposes its ISO 3166-2 subdivisions as a Subdivisions collection, which may be empty for territories that have none. A Subdivision can also be created directly from its code with fromString or tryFromString.

All countries

Countries::all returns every ISO 3166-1 country as a collection of Country handles.

Timezones

Every Country exposes a CountryTimezones collection, built from the IANA timezone database through PHP. The first identifier is the default, and it falls back to UTC for territories without an assigned timezone.

License

Country is licensed under MIT.

Contributing

Please follow the contributing guidelines to contribute to the project.


All versions of country with dependencies

PHP Build Version
Package Version
Requires php Version ^8.5
tiny-blocks/collection Version ^2.5
tiny-blocks/time Version ^2.3
tiny-blocks/value-object Version ^5.0
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 tiny-blocks/country contains the following files

Loading the files please wait ...