PHPackages                             rocketfellows/country-vat-number-format-validators-config - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. rocketfellows/country-vat-number-format-validators-config

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

rocketfellows/country-vat-number-format-validators-config
=========================================================

v1.0.0(3y ago)06582MITPHPPHP &gt;=7.4

Since Apr 22Pushed 3y agoCompare

[ Source](https://github.com/rocketfellows/country-vat-number-format-validators-config)[ Packagist](https://packagist.org/packages/rocketfellows/country-vat-number-format-validators-config)[ RSS](/packages/rocketfellows-country-vat-number-format-validators-config/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (7)Versions (2)Used By (2)

Country vat number format validator config interface
====================================================

[](#country-vat-number-format-validator-config-interface)

[![Code Coverage Badge](./badge.svg)](./badge.svg)

This package provides an interface for configuring country-specific vat number format validators. In other words, the interface helps to unambiguously specify a set of validators (in the form of a tuple) for a particular country. Also in this package are presented:

- a simple implementation of the interface in the form of a DTO;
- implementation of a tuple of objects that implement the interface for configuring vat number format validators for a specific country.

Below is a component class diagram:

[![img.png](img.png)](img.png)

Installation
------------

[](#installation)

```
composer require rocketfellows/country-vat-number-format-validators-config
```

Dependencies
------------

[](#dependencies)

-  v1.1.0
-  v1.0.2
-  v1.0.0

List of package components
--------------------------

[](#list-of-package-components)

- ***CountryVatNumberFormatValidatorsConfigInterface*** - interface for configuring country-specific vat number format validators;
- ***CountryVatNumberValidatorsConfig*** - simple implementation of ***CountryVatNumberFormatValidatorsConfigInterface*** interface, which is a DTO initialized, by country (an object of type Country) and tuple of validators (a list of objects of type ***CountryVatFormatValidatorInterface***);
- ***CountryVatNumberFormatValidatorsConfigs*** - vat number format validators configuration tuple for countries, is a list of elements, each element of which is an object of type ***CountryVatNumberFormatValidatorsConfigInterface***, also provides a number of functions for searching by tuple;

CountryVatNumberFormatValidatorsConfigInterface description
-----------------------------------------------------------

[](#countryvatnumberformatvalidatorsconfiginterface-description)

Interface for configuring country-specific vat number format validators.

Methods that class must implement according to the interface:

- ***getCountry*** - country object getter, must return an object of type ***arslanimamutdinov\\ISOStandard3166\\Country***;
- ***getValidators*** - vat number format validators tuple getter, must return an object of type ***rocketfellows\\CountryVatFormatValidatorInterface\\CountryVatFormatValidators***;

CountryVatNumberValidatorsConfig description
--------------------------------------------

[](#countryvatnumbervalidatorsconfig-description)

Simple implementation of ***CountryVatNumberFormatValidatorsConfigInterface*** interface, which is a DTO initialized, by country (an object of type Country) and tuple of validators (a list of objects of type ***CountryVatFormatValidatorInterface***).

The class constructor takes two parameters:

- ***$country*** - object instance of arslanimamutdinov\\ISOStandard3166\\Country;
- ***$validators*** - vat number format validators tuple, an object of type ***rocketfellows\\CountryVatFormatValidatorInterface\\CountryVatFormatValidators***;

Object instantiating example:

```
/**
* FirstRUVatNumberValidator and SecondRUVatNumberValidator are implemented CountryVatFormatValidatorInterface
*/
$validators = new CountryVatFormatValidators(new FirstRUVatNumberValidator(), new SecondRUVatNumberValidator());
$config = new CountryVatNumberValidatorsConfig(Country::RU(), $validators);

$config->getCountry();      // will return RU country object
$config->getValidators();   // will return $validators tuple
```

CountryVatNumberFormatValidatorsConfigs description
---------------------------------------------------

[](#countryvatnumberformatvalidatorsconfigs-description)

Vat number format validators configuration tuple for countries. Is a list of elements, each element of which is an object of type ***CountryVatNumberFormatValidatorsConfigInterface***. Also provides a number of functions for searching by tuple.

Tuple provides looping by its elements:

```
// implements CountryVatNumberFormatValidatorsConfigInterface
$ruVatNumberFormatValidatorsConfig = new CountryVatNumberValidatorsConfig(
    Country::RU(),
    new CountryVatFormatValidators(new RUVatNumberFormatValidator())
);

// implements CountryVatNumberFormatValidatorsConfigInterface
$deVatNumberFormatValidatorsConfig = new CountryVatNumberValidatorsConfig(
    Country::DE(),
    new CountryVatFormatValidators(new DEVatNumberFormatValidator())
);

// implements CountryVatNumberFormatValidatorsConfigInterface
$atVatNumberFormatValidatorsConfig = new CountryVatNumberValidatorsConfig(
    Country::AT(),
    new CountryVatFormatValidators(new ATVatNumberFormatValidator())
);

$configs = new CountryVatNumberFormatValidatorsConfigs(
    $ruVatNumberFormatValidatorsConfig,
    $deVatNumberFormatValidatorsConfig,
    $atVatNumberFormatValidatorsConfig
);

// each $config variable is an instance of CountryVatNumberFormatValidatorsConfigInterface
foreach ($configs as $config) {
    $config->getCountry();      // returns Country of current config
    $config->getValidators();   // return CountryVatFormatValidators of current config
}
```

***CountryVatNumberFormatValidatorsConfigs*** public functions:

- ***getCountryValidators(Country $country)*** - returns unique validators (object instance of CountryVatFormatValidators) for given ***Country*** object from tuple, if there is not validators for given country will return empty tuple;
- ***getValidatorsByCountryCode(string $countryCode)*** - returns unique validators (object instance of ***CountryVatFormatValidators***) for given country code (search by alpha2, alpha3 and numeric code) from tuple, if there is not validators for given country code will return empty tuple;

Search functions will return a ***CountryVatFormatValidators*** tuple, which will consist of a list of unique validators. For example, the initial configuration tuple ***CountryVatNumberFormatValidatorsConfigs*** may contain several configurations for the same country. In this case, the tuple will contain unique validators from all configurations of the desired country. Also, one configuration can be given for a country, but it can contain the same validators, in which case the tuple of validators for the desired country will also consist of unique validators.

More search use cases can be found in tests:

- ***rocketfellows\\CountryVatNumberFormatValidatorsConfig\\tests\\unit\\GetCountryValidatorsTest***;
- ***rocketfellows\\CountryVatNumberFormatValidatorsConfig\\tests\\unit\\GetValidatorsByCountryCodeTest***;

Contributing
------------

[](#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.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 79.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1117d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/81402dcd0a07ad550b7f80f5871e7c302770b29d4c73a52fc35ba697f702d56e?d=identicon)[arslanim](/maintainers/arslanim)

---

Top Contributors

[![arslanim](https://avatars.githubusercontent.com/u/22678154?v=4)](https://github.com/arslanim "arslanim (71 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (18 commits)")

---

Tags

country-vat-number-format-validator-config

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/rocketfellows-country-vat-number-format-validators-config/health.svg)

```
[![Health](https://phpackages.com/badges/rocketfellows-country-vat-number-format-validators-config/health.svg)](https://phpackages.com/packages/rocketfellows-country-vat-number-format-validators-config)
```

###  Alternatives

[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
