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

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

slick/validator
===============

Slick/Validator is a simple library with useful input validators

v1.1.0(10y ago)03.4k1MITPHP

Since Feb 1Pushed 10y ago2 watchersCompare

[ Source](https://github.com/slickframework/validator)[ Packagist](https://packagist.org/packages/slick/validator)[ Docs](https://github.com/slickframework/validator)[ RSS](/packages/slick-validator/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)Dependencies (4)Versions (4)Used By (1)

Slick Validator package
=======================

[](#slick-validator-package)

[![Latest Version](https://camo.githubusercontent.com/a97efa951d66dee1c74c76f82b60f5ba15acedd6692564ab5ebde5b66a7dab75/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f736c69636b6672616d65776f726b2f76616c696461746f722e7376673f7374796c653d666c61742d737175617265)](https://github.com/slickframework/validator/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/431bf8c24b3724a919ae6f7062f96182c0fa6c93bc5bde996db3ea2218f36a0a/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f736c69636b6672616d65776f726b2f76616c696461746f722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/slickframework/validator)[![Coverage Status](https://camo.githubusercontent.com/a3cd8fdc75241a525b70fd375ec78bf90e47f9be424837f7ea11e5373ee433d3/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f736c69636b6672616d65776f726b2f76616c696461746f722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/slickframework/validator/code-structure?branch=master)[![Quality Score](https://camo.githubusercontent.com/803fb15121b9b4bdae8b57954730b2d2cba78de26b726f837029da0134f50d9b/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f736c69636b6672616d65776f726b2f76616c696461746f722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/slickframework/validator?branch=master)[![Total Downloads](https://camo.githubusercontent.com/dcabbe5c6900912c544bad0bd192f593a24e59bd97569df0dfb24cea573c07e5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736c69636b2f76616c696461746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/slick/validator)

`Slick/Validator` is a set of input validation tools that can be used to check your input data. It also has the concept of *Validation Chain* that can combine validators for a specific validation.

This package is compliant with PSR-2 code standards and PSR-4 autoload standards. It also applies the [semantic version 2.0.0](http://semver.org) specification.

Install
-------

[](#install)

Via Composer

```
$ composer require slick/validator
```

Usage
-----

[](#usage)

One of the easiest ways of using a validator is using `StaticValidator` class to check a value:

```
use Slick\Validator\StaticValidator;

if (StaticValidator::validates('notEmpty', $value) {
  // Some code with valid value
} else {
  print StaticValidator::getMessage(); // Print out validation messages
}
```

`Slick/Validator` comes with the following validators:

AliasDescriptionClass*notEmpty*Fails if passed value is an empty string`Slick\Validator\NotEmpty`*email*Fails if passed value is not a valid e-mail address`Slick\Validator\Email`*number*Fails if passed value is not am integer number`Slick\Validator\Number`*alphaNumeric*Fails if passed value is not an alpha numeric value`Slick\Validator\AlphaNumeric`*url*Fails if passed value is not an URL`Slick\Validator\URL``StaticValidator` is also a validator objects factory. For example:

```
use Slick\Validator\StaticValidator;

$urlValidator = StaticValidator::create('notEmpty', 'You must enter a valid URL.');

if ($urlValidator->validates($_POST['url']) {
    // URL is valid use it...
} else {
    print $urlValidator->getMessage(); // Will print out 'You must enter a valid URL.'
}
```

Combining various validator to use it as a single validation can be done with `ValidationChain`.

```
use Slick\Validator\StaticValidator;
use Slick\Validator\ValidationChain;

$emailValidation = new ValidationChain();
$emailValidation
    ->add(StaticValidator::create('notEmpty', 'Email address cannot be empty.'))
    ->add(StaticValidator::create('email', 'The entered e-mail is not a valid address.');

if ($emailValidation->validates($_POST['email']) {
    // URL is valid use it...
} else {
    print implode(', ', $emailValidation->getMessages());
    // Will print out the validation messages for the validator(s) that fail.
}
```

You can always create your own validator and use the `StaticValidator` or the `ValidationChain` as long as you implement the `Slick\Validator\ValidatorInterface` or `Slick\Validator\ValidationChainInterface`.

Testing
-------

[](#testing)

```
$ vendor/bin/phpunit
```

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Slick framework](https://github.com/slickframework)
- [All Contributors](https://github.com/slickframework/common/graphs/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity65

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

2

Last Release

3758d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/101112?v=4)[fsilva](/maintainers/fsilva)[@fsilva](https://github.com/fsilva)

---

Top Contributors

[![silvamfilipe](https://avatars.githubusercontent.com/u/5720969?v=4)](https://github.com/silvamfilipe "silvamfilipe (5 commits)")

---

Tags

validationslickinput-validation

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/slick-validator/health.svg)

```
[![Health](https://phpackages.com/badges/slick-validator/health.svg)](https://phpackages.com/packages/slick-validator)
```

###  Alternatives

[composer/semver

Version comparison library that offers utilities, version constraint parsing and validation.

3.3k489.6M672](/packages/composer-semver)[giggsey/libphonenumber-for-php

A library for parsing, formatting, storing and validating international phone numbers, a PHP Port of Google's libphonenumber.

5.0k148.7M416](/packages/giggsey-libphonenumber-for-php)[respect/validation

The most awesome validation engine ever created for PHP

5.9k37.4M383](/packages/respect-validation)[propaganistas/laravel-phone

Adds phone number functionality to Laravel based on Google's libphonenumber API.

3.0k35.7M107](/packages/propaganistas-laravel-phone)[opis/json-schema

Json Schema Validator for PHP

64236.9M186](/packages/opis-json-schema)[giggsey/libphonenumber-for-php-lite

A lite version of giggsey/libphonenumber-for-php, which is a PHP Port of Google's libphonenumber

8412.9M47](/packages/giggsey-libphonenumber-for-php-lite)

PHPackages © 2026

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