Download the PHP package rocketfellows/country-vat-number-format-validator without Composer

On this page you can find all versions of the php package rocketfellows/country-vat-number-format-validator. 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-vat-number-format-validator

Configurable country vat number format validator.

The package provides configurable services for validating country vat number formats.

Installation.

Dependencies.

References.

The packages below can be connected to the validator right away because they contain preconfigured validators for the following countries:

Interface for validating country vat number format.

Service for checking the vat number format for the country: rocketfellows\CountryVatNumberFormatValidator\VatNumberFormatValidatorService

Function to check if the country vat number format is correct: rocketfellows\CountryVatNumberFormatValidator\VatNumberFormatValidatorService::validateCountryVatNumber

Input parameters:

Throwable exceptions:

Return value is instance of rocketfellows\CountryVatNumberFormatValidator\VatNumberFormatValidationResult.

VatNumberFormatValidationResult description:

Usage example of preconfigured validators for countries.

To use the preconfigured validators for a country, you need to install the appropriate package from the list above from section "References".

Example of instantiating VatNumberFormatValidatorService:

Valid country vat number format examples.

Austria vat number.

Validation result:

Germany vat number.

Validation result:

Invalid country vat number format examples.

Austria vat number.

Validation result:

Germany vat number.

Validation result:

VatNumberFormatValidator.

In case you don't need the details of the validation process of the country vat number format, but just want to get the answer "vat number is valid or not", you can use the rocketfellows\CountryVatNumberFormatValidator\VatNumberFormatValidator.

Class methods:

VatNumberFormatValidator takes an object of type VatNumberFormatValidatorService as a dependency, which you must configure in advance.

Throwable exceptions:

VatNumberFormatValidator configuration example.

VatNumberFormatValidator usage examples.

Austria valid vat number validation:

Validation result:

Austria invalid vat number validation:

Validation result:

Expandability.

If you need to expand the list of countries whose vat numbers you want to check, you will need to do the following:

Example

Suppose we need to add a vat number validator for the country Qatar.

First we need to implement the vat number validator for the country - a class that implements the interface rocketfellows\CountryVatFormatValidatorInterface\CountryVatFormatValidatorInterface.

For simplicity, let's assume that a valid vat number is a string that contains only numbers and consists of three characters.

To implement the validator interface, we use the prepared abstract class rocketfellows\CountryVatFormatValidatorInterface\CountryVatFormatValidator.

Validator implementation:

Next, you need to associate the validator with the country through the configurator class. Class must implement rocketfellows\CountryVatNumberFormatValidatorsConfig\CountryVatNumberFormatValidatorsConfigInterface.

Config class:

And that's almost all, we just need to connect the new configuration to the service rocketfellows\CountryVatNumberFormatValidator\VatNumberFormatValidatorService.

VatNumberFormatValidatorService configuration:

As you can see, in addition to the vat validators for Austria and Germany, we have included a validator for the country Qatar.

An example of a valid vat number for the country Qatar from our example:

Result:

An example of an invalid vat number for the country Qatar from our example:

Result:

As you can see it works great.

Contributing.

Welcome to pull requests. If there is a major changes, first please open an issue for discussion.

Please make sure to update tests as appropriate.


All versions of country-vat-number-format-validator with dependencies

PHP Build Version
Package Version
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 rocketfellows/country-vat-number-format-validator contains the following files

Loading the files please wait ....