定制 regexto/validators 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

regexto/validators

Composer 安装命令:

composer require regexto/validators

包简介

A curated collection of battle-tested regex patterns with PHP validation.

README 文档

README

Curated, production-ready, and battle-tested regex patterns for PHP, backed by the regex.to pattern registry.

All patterns are open-source, fully tested, and visualized live on regex.to.

npm pypi crates.io packagist pkg.go.dev Tested & Visualized Live

Why regexto/validators?

  • 🔍 Tested and Visualized Live: Every single pattern in this library can be searched, tested, and visualized interactively at regex.to.
  • 🚀 Zero Dependencies: Pure PHP validation. Lightweight and lightning-fast.
  • 📁 JSON Single Source of Truth: Patterns are declared declaratively in standard JSON files shared across multiple languages.

Installation

composer require regexto/validators

Quick Start

1. Basic Validation (PHP)

<?php

require 'vendor/autoload.php';

use RegexTo\Validators\Validator;

// 1. Quick boolean test (substring match)
$isMatched = Validator::test('email', 'Please contact us at contact@regex.to'); // true

// 2. Strict full-string validation
$isValid = Validator::validate('email', 'contact@regex.to'); // true

2. Smart Type Auto-Detection

Pass an unknown string, and the validator will identify matching formats:

<?php

require 'vendor/autoload.php';

use RegexTo\Validators\Validator;

$results = Validator::detect('192.168.0.1');
echo $results[0]['pattern']['slug']; // "ipv4"

Available Patterns

Here is a curated subset of the 79+ patterns supported. View all of them and test them live at regex.to/patterns:

Slug Name Category Live Sandbox
email Email Address Internet Test Live ↗
url URL (HTTP/HTTPS) Internet Test Live ↗
ipv4 IPv4 Address Network Test Live ↗
ipv6 IPv6 Address Network Test Live ↗
hex-color Hex Color Design Test Live ↗
semver Semantic Version Dev Test Live ↗
uuid UUID Dev Test Live ↗
credit-card Credit Card Number Finance Test Live ↗
iban IBAN Finance Test Live ↗
pl-nip Polish NIP (Tax ID) Finance Test Live ↗

License

MIT

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-07-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固