Download the PHP package baraja-core/phone-number without Composer

On this page you can find all versions of the php package baraja-core/phone-number. 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 phone-number

Validation and formatting of telephone numbers

Read Czech version

There is no easy way to validate and format phone numbers in PHP, so I wrote a simple library for this that has no dependencies, but still handles this role.

The goal is to check the format of a phone number, or convert it to a basic canonical form (which is always valid).

Installing

Simply composer:

How to use the library

The principle of this tool is based on formatting and validating phone numbers from the user, or from sources over which you have no control.

The most common use is to correct phone number formatting:

The function fixes the number formatting and returns the string +420 777 123 456.

If no prefix is specified by the user, the +420 prefix is assumed. You can change the default preference with the second parameter:

The phone code is overwritten only if the user does not enter it and it fails to be detected automatically.

Input and output formatting

The input string can look (almost) any way. The built-in algorithm can automatically remove non-valid characters (for example, some users write a note next to a phone number that will be removed automatically). So you don't have to worry about formatting the input at all, but the output will always be consistent.

The output always looks the same (it is normalized to the canonical format).

The general format is:

If you submit a non-valid input (or an input that cannot be automatically corrected), an exception will be thrown.

Error trapping

If the number cannot be safely normalized to a base form, or does not exist, throw an \InvalidArgumentException exception.

If you wish to convert the exception to a boolean, use the built-in asset validator:


All versions of phone-number with dependencies

PHP Build Version
Package Version
Requires php Version ^8.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 baraja-core/phone-number contains the following files

Loading the files please wait ....