matusstafura/magento2-phone-validation

Phone validation for Magento 2

v0.2.0 2025-08-03 08:53 UTC

This package is auto-updated.

Last update: 2025-08-03 09:01:02 UTC


README

Problem: Magento 2 allows invalid characters in the phone number field:

Fresh Magento 2 installation:
before validation
Validation with Module:
after validation

This module adds phone number validation to key Magento 2 forms such as:

  • 🛒 Checkout (shipping & billing address)
  • 🧑 during Customer registration (todo)

📦 Installation (via Composer Path Repository)

  1. Install via composer(recommended)
composer require matusstafura/magento2-phone-validation  

or clone this module to app/code/MatusStafura/PhoneValidation:

git clone git@github.com:matusstafura/magento2-phone-validation.git 
  1. Enable and compile module:
bin/magento module:enable MatusStafura_PhoneValidation
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:flush
  1. Enable / disable in Admin:

Stores > Configuration > Customers > Customer Configuration > Phone Validation

🤝 Contributing

Contributions are very welcome! If you'd like to improve the module, add features, fix bugs, or improve documentation:

  1. Fork the repository
  2. Create a new branch:
  git checkout -b feature/your-feature-name
  1. Make your changes and commit with clear messages
  2. Push to your fork:
  git push origin feature/your-feature-name
  1. Open a pull request on GitHub

📃 License

MIT

Support

"Buy Me A Coffee"