PHPackages                             marcw/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. marcw/validator

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

marcw/validator
===============

Extra validators for the Symfony Validator component

3.0.0(3y ago)7329MITPHP

Since Sep 8Pushed 3y ago1 watchersCompare

[ Source](https://github.com/marcw/validator)[ Packagist](https://packagist.org/packages/marcw/validator)[ RSS](/packages/marcw-validator/feed)WikiDiscussions main Synced yesterday

READMEChangelogDependencies (3)Versions (10)Used By (0)

Validator
=========

[](#validator)

[![Build Status](https://camo.githubusercontent.com/376ef546b1a68fd8becb37a64c7f40d305d7e8017c08a5c46c9feda9f5914051/68747470733a2f2f7472617669732d63692e6f72672f6d617263772f76616c696461746f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/marcw/validator)[![Coverage Status](https://camo.githubusercontent.com/a5c51e4660cd00065c76bfcd1d552ddfe78c2d16fde92ad7fb3956429ba97258/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6d617263772f76616c696461746f722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/marcw/validator?branch=master)[![SensioLabsInsight](https://camo.githubusercontent.com/576407b35043e270ac4df0f6724099ad6026aa5500db86a6ddd90a08dca21930/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f37356366336133662d613136642d346630352d613365382d3436623139306234646166352f6d696e692e706e67)](https://insight.sensiolabs.com/projects/75cf3a3f-a16d-4f05-a3e8-46b190b4daf5)

Some additions to the [Validator Symfony Component](github.com/symfony/symfony).

Subdomain validation
--------------------

[](#subdomain-validation)

Validate a string value based on these rules:

- Be not null.
- Be not blank.
- Be more than or equal to 3 characters.
- Be less than 63 characters.
- Be in alphanumeric and hyphen.
- Do not start with an hyphen.
- Do not end with an hyphen.

Username validation
-------------------

[](#username-validation)

Validate a string value based on [The Big Username Blocklist](https://github.com/marteinn/The-Big-Username-Blocklist). It won't validate if the value is equal to one of these terms.

GoogleAnalytics Tracker ID validation
-------------------------------------

[](#googleanalytics-tracker-id-validation)

Validate that a string matches the correct format for a Google Analytics Tracker ID.

SMS Message Validation.
-----------------------

[](#sms-message-validation)

Validate that a value fits in one (or more) SMS message.

HTMLColor validator
-------------------

[](#htmlcolor-validator)

Validate that a string matches the basic HTML format for a color (`#abc` or `#abcdef`)

Example
-------

[](#example)

```
