PHPackages                             hryvinskyi/magento2-quote-address-validator - 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. hryvinskyi/magento2-quote-address-validator

ActiveMagento2-module[Validation &amp; Sanitization](/categories/validation)

hryvinskyi/magento2-quote-address-validator
===========================================

N/A

1.0.4.2(1y ago)1229MITPHPPHP ~7.3.0||~7.4.0||~8.0||~8.1||~8.2||~8.3

Since Aug 7Pushed 1y ago1 watchersCompare

[ Source](https://github.com/hryvinskyi/magento2-quote-address-validator)[ Packagist](https://packagist.org/packages/hryvinskyi/magento2-quote-address-validator)[ RSS](/packages/hryvinskyi-magento2-quote-address-validator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (2)Versions (9)Used By (0)

Hryvinskyi\_QuoteAddressValidator
=================================

[](#hryvinskyi_quoteaddressvalidator)

[![Latest Stable Version](https://camo.githubusercontent.com/9b356a580cb52adeaee9f4ef69de590d86b48904b6598fa2fb1740e56f4d107e/68747470733a2f2f706f7365722e707567782e6f72672f68727976696e736b79692f6d6167656e746f322d71756f74652d616464726573732d76616c696461746f722f763f31323334)](https://packagist.org/packages/hryvinskyi/magento2-quote-address-validator) [![Total Downloads](https://camo.githubusercontent.com/6ab6bbe6ccf82c39e7d6946fe9c4aa13ccf20c091fc0485bb9027a95c94cc051/68747470733a2f2f706f7365722e707567782e6f72672f68727976696e736b79692f6d6167656e746f322d71756f74652d616464726573732d76616c696461746f722f646f776e6c6f616473)](https://packagist.org/packages/hryvinskyi/magento2-quote-address-validator) [![Latest Unstable Version](https://camo.githubusercontent.com/e9ed6ba9b91b0828af2cea9c8eace523052af288615e7817400b25030ca6d805/68747470733a2f2f706f7365722e707567782e6f72672f68727976696e736b79692f6d6167656e746f322d71756f74652d616464726573732d76616c696461746f722f762f756e737461626c65)](https://packagist.org/packages/hryvinskyi/magento2-quote-address-validator) [![License](https://camo.githubusercontent.com/38115ada9a76a4c6d107c8becd9e4cc2ea271cb2cc06595b57c3c04856bed5d7/68747470733a2f2f706f7365722e707567782e6f72672f68727976696e736b79692f6d6167656e746f322d71756f74652d616464726573732d76616c696461746f722f6c6963656e7365)](https://packagist.org/packages/hryvinskyi/magento2-quote-address-validator) [![PHP Version Require](https://camo.githubusercontent.com/0030afb442cac7bb410795e49f0503bd14866b311adca77613d983685e5e61c0/68747470733a2f2f706f7365722e707567782e6f72672f68727976696e736b79692f6d6167656e746f322d71756f74652d616464726573732d76616c696461746f722f726571756972652f706870)](https://packagist.org/packages/hryvinskyi/magento2-quote-address-validator)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/d6916999dcad5234f496270d1a235a12e5189ac9da000e5a6cc49fe34999f4e3/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f68727976696e736b79692f6d6167656e746f322d71756f74652d616464726573732d76616c696461746f722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/hryvinskyi/magento2-quote-address-validator/?branch=master)[![workflow](https://github.com/hryvinskyi/magento2-quote-address-validator/actions/workflows/unit-test.yml/badge.svg)](https://github.com/hryvinskyi/magento2-quote-address-validator/actions/workflows/unit-test.yml/badge.svg)

Overview
--------

[](#overview)

The `Hryvinskyi_QuoteAddressValidator` module provides validation for quote addresses in Magento 2. It allows administrators to configure regex patterns and error messages for validating various address fields such as lastname and street.

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

[](#installation)

1. **Composer Installation:**```
    composer require hryvinskyi/magento2-quote-address-validator
    ```
2. **Enable the Module:**```
    php bin/magento module:enable Hryvinskyi_QuoteAddressValidator
    ```
3. **Clear Cache:**```
    php bin/magento cache:clean
    ```

Configuration
-------------

[](#configuration)

1. Navigate to `Stores > Configuration > Security > Quote Address Validator.`
2. Configure the following fields:
    - **Enable:** Set to `Yes` to enable the module.
    - **Validation Type:** Select the type of validation to apply to the address fields.
        - **`Validate by Regex`** - Validate the address fields using a regex pattern.
        - **`Validate by stopwords`** - Validate the address fields using a list of stopwords.
        - **`Validate by stopwords and regex`** - Validate the address fields using a list of stopwords and a regex pattern.
    - **Enable Firstname Validation** Set to `Yes` to enable validation for the firstname field.
    - **Firstname Stopwords** Enter a list of stopwords to validate the firstname field.
    - **Firstname Regex** Enter a regex pattern to validate the firstname field.
    - **Firstname Error Message** Enter an error message to display when the firstname field does not match the pattern.
    - **Enable Lastname Validation** Set to `Yes` to enable validation for the lastname field.
    - **Lastname Stopwords:** Enter a list of stopwords to validate the lastname field.
    - **Lastname Regex:** Enter a regex pattern to validate the lastname field.
    - **Lastname Error Message:** Enter an error message to display when the lastname field does not match the pattern.
    - **Enable Street Validation** Set to `Yes` to enable validation for the street field.
    - **Street Stopwords:** Enter a list of stopwords to validate the street field.
    - **Street Regex:** Enter a regex pattern to validate the street field.
    - **Street Error Message:** Enter an error message to display when the street field does not match the pattern.

Command Line Interface
----------------------

[](#command-line-interface)

The module provides a command-line interface (CLI) to validate quote addresses. To use the CLI, run the following command:

```
php bin/magento hryvinskyi:quote-address-validator:check-existing-addresses
```

This command will validate all existing quote addresses and display any errors that are found. This is useful for detecting country-specific errors in addresses and names and changing Regex patterns for validation.

Console Responce Example. Click to expand[![console_response.png](./docs/images/console_response.png)](./docs/images/console_response.png)

Example Regex Patterns
----------------------

[](#example-regex-patterns)

- Firstname Regex: `/^([\p{L}0-9&#$€£¥¢%&?!()@_:;,'+\s\-\.\*\/\\\\]{1,50})$/u`
- Lastname Regex: `/^([\p{L}0-9&#$€£¥¢%&?!()@_:;,'+\s\-\.\*\/\\\\]{1,50})$/u`
- Street Regex: `/^([\p{L}0-9&#$€£¥¢%&?!()@_:;,'+\s\-\.\*\/\\\\]*)$/u`

Explanation of Regex
--------------------

[](#explanation-of-regex)

- `^`: asserts position at start of the string
- `[\p{L}0-9&#$€£¥¢%&?!()@_:;,'+\s\-\.\*\/\\\\]`: A character class that allows:
    - `\p{L}`: in a regex pattern, it will match any character that is considered a letter in Unicode.
    - `0-9`: Any digit.
    - `&`: Ampersand.
    - `#`: Hash symbol.
    - `$`: Dollar sign.
    - `€`: Euro sign.
    - `£`: Pound sign.
    - `¥`: Yen sign.
    - `¢`: Cent sign.
    - `%`: Percent sign.
    - `?`: Question mark.
    - `!`: Exclamation mark.
    - `(`: Opening parenthesis.
    - `)`: Closing parenthesis.
    - `@`: At symbol.
    - `_`: Underscore.
    - `:`: Colon.
    - `;`: Semicolon.
    - `,`: Comma.
    - `'`: Apostrophe.
    - `+`: Plus sign.
    - `\s`: Any whitespace character (spaces, tabs, line breaks).
    - `\-`: Hyphen. (Note that the hyphen is escaped because it is a special character in regex.)
    - `\.`: Period. (Note that the dot is escaped because it is a special character in regex.)
    - `\*`: Asterisk. (Note that the asterisk is escaped because it is a special character in regex.)
    - `\/`: Forward slash. (Note that the slash is escaped because it is a special character in regex.)
    - `\\\\`: Backslash (the double backslash is necessary to escape the backslash itself in PHP strings and regex).
- `*`: Matches zero or more occurrences of the preceding element.
- `{1,50}`: Matches between 1 and 50 occurrences of the preceding element.
- `$`: asserts position at the end of the string.
- `u`: modifier: Treats the pattern as UTF-8, necessary for proper Unicode matching.

Notes
-----

[](#notes)

Preference for `\Magento\Quote\Model\BillingAddressManagement` added only for correct error message display. (added `LocalizedException` catch to `assign` method)

Demo Backend
------------

[](#demo-backend)

Configuration[![Admin](./docs/images/configuration_settings_stores_magento_admin.gif)](./docs/images/configuration_settings_stores_magento_admin.gif)

Demo Frontend
-------------

[](#demo-frontend)

Checkout shipping address validation[![checkout](./docs/images/checkout_testing.gif)](./docs/images/checkout_testing.gif)

Checkout billing address validation[![checkout](./docs/images/checkout_testing_billing.gif)](./docs/images/checkout_testing_billing.gif)

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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

Every ~0 days

Total

8

Last Release

641d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e254b6c28f67e639b2beb3f21a80f2b4ff9efc5ee782943d497b73523f630c1d?d=identicon)[hryvinskyi](/maintainers/hryvinskyi)

---

Top Contributors

[![hryvinskyi](https://avatars.githubusercontent.com/u/9294098?v=4)](https://github.com/hryvinskyi "hryvinskyi (32 commits)")

---

Tags

cve-2022-24086magentomagento2magento2-extensionmagento2-extension-freemagento2-modulemagento2-module-freemagento2-security

### Embed Badge

![Health badge](/badges/hryvinskyi-magento2-quote-address-validator/health.svg)

```
[![Health](https://phpackages.com/badges/hryvinskyi-magento2-quote-address-validator/health.svg)](https://phpackages.com/packages/hryvinskyi-magento2-quote-address-validator)
```

###  Alternatives

[dotdigital/dotdigital-magento2-extension

Dotdigital for Magento 2

50374.2k18](/packages/dotdigital-dotdigital-magento2-extension)[o2ti/sigep-web-carrier

O2TI - Sigep Web Carrier

141.5k](/packages/o2ti-sigep-web-carrier)

PHPackages © 2026

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