PHPackages                             guysartorelli/silverstripe-composable-validators - 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. guysartorelli/silverstripe-composable-validators

ActiveSilverstripe-vendormodule[Validation &amp; Sanitization](/categories/validation)

guysartorelli/silverstripe-composable-validators
================================================

Adds composable form validators with reusable validation logic.

3.0.1(11mo ago)52.5k[2 issues](https://github.com/GuySartorelli/silverstripe-composable-validators/issues)BSD-3-ClausePHPPHP ^8.3CI passing

Since Jul 11Pushed 11mo ago2 watchersCompare

[ Source](https://github.com/GuySartorelli/silverstripe-composable-validators)[ Packagist](https://packagist.org/packages/guysartorelli/silverstripe-composable-validators)[ Docs](https://github.com/GuySartorelli/silverstripe-composable-validators)[ RSS](/packages/guysartorelli-silverstripe-composable-validators/feed)WikiDiscussions 3 Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (20)Used By (0)

Silverstripe Composable Validators
==================================

[](#silverstripe-composable-validators)

Thank you to [Signify](https://github.com/signify-nz) for making this module possible.

This module provides a number of reusable composable validators (including AJAX validation) for use both in the CMS and in frontend forms.

Make sure you check out the [extensions documentation](docs/en/02-extensions.md) at a minimum - some of these should be applied in almost all projects using this module.

If your project has any automated client-side tests, or you are implementing a validator to be compatible with this module, please make sure you read the [client side tests documentation](docs/en/03-client-side-tests.md).

Install
-------

[](#install)

Install via [composer](https://getcomposer.org):

```
composer require guysartorelli/silverstripe-composable-validators
```

Gotchas
-------

[](#gotchas)

### Form submission with an `AjaxCompositeValidator`

[](#form-submission-with-an-ajaxcompositevalidator)

The `AjaxCompositeValidator` adds a submit handler to your form. This doesn't always interact well with other submit handlers, and can result in either front-end validation being skipped or the form not submitting the way you expect it to, depending on which submit handler gets the event first. For best results, don't add additional submit handlers to the form.

If you're using the `AjaxCompositeValidator` on a form that uses [undefinedoffset/silverstripe-nocaptcha](https://github.com/UndefinedOffset/silverstripe-nocaptcha), you should disable form submission handling for the `NocaptchaField` in that form (see instructions in the nocaptcha docs).

[Available Validators](docs/en/01-validators.md)
------------------------------------------------

[](#available-validators)

- **[`AjaxCompositeValidator`](docs/en/01-validators.md#ajaxcompositevalidator)**
    Subclass of [`CompositeValidator`](https://api.silverstripe.org/6/SilverStripe/Forms/Validation/CompositeValidator.html) that provides AJAX validation. Resolves [an issue with losing data](https://github.com/silverstripe/silverstripe-elemental/issues/764), faster turn-around for fixing validation problems, and provides a way to use the same validation for 'client-side' validation of frontend forms.
- **[`WarningFieldsValidator`](docs/en/01-validators.md#warningfieldsvalidator)**
    Displays a warning if some field(s) doesn't have a value. Useful for alerting users about data that is technically valid but may not provide the results they expect
- **[`DependentRequiredFieldsValidator`](docs/en/01-validators.md#dependentrequiredfieldsvalidator)**
    Uses [`SearchFilter`s](https://docs.silverstripe.org/en/developer_guides/model/searchfilters/) to define fields as required conditionally, based on the values of other fields (e.g. only required if `OtherField` has a value greater than 25).
- **[`RequiredBlocksValidator`](docs/en/01-validators.md#requiredblocksvalidator)**
    Require a specific [elemental block(s)](https://github.com/silverstripe/silverstripe-elemental) to exist in the `ElementalArea`, with optional minimum and maximum numbers of blocks and optional positional validation.
- **[`ConstraintsValidator`](docs/en/01-validators.md#constraintsvalidator)**
    Validate values against [`symfony/validation` constraints](https://symfony.com/doc/current/reference/constraints.html). This is super powerful - definitely check it out.

### [Abstract Validators](docs/en/01-validators.md#abstract-validators)

[](#abstract-validators)

- **[`BaseValidator`](docs/en/01-validators.md#basevalidator)**
    Includes methods useful for getting the actual `FormField` and its label.
- **[`FieldHasValueValidator`](docs/en/01-validators.md#fieldhasvaluevalidator)**
    Subclass of `BaseValidator`. Useful for validators that require logic to check if a field has any value or not.

[Traits](docs/en/01-validators.md#traits)
-----------------------------------------

[](#traits)

- **[`ValidatesMultipleFields`](docs/en/01-validators.md#validatesmultiplefields)**
    Useful for validators that can be fed an array of field names to be validated.
- **[`ValidatesMultipleFieldsWithConfig`](docs/en/01-validators.md#validatesmultiplefieldswithconfig)**
    Like `ValidatesMultipleFields` but requires a configuration array for each field to be validated.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance44

Moderate activity, may be stable

Popularity24

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 98.1% 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 ~37 days

Recently: every ~77 days

Total

20

Last Release

331d ago

Major Versions

1.1.0 → 2.0.02023-09-07

1.x-dev → 2.0.x-dev2023-09-28

2.3.x-dev → 3.0.02025-06-13

PHP version history (3 changes)1.0.0PHP ^7.3 || ^8.0

2.0.0PHP ^8.1

3.0.0PHP ^8.3

### Community

Maintainers

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

---

Top Contributors

[![GuySartorelli](https://avatars.githubusercontent.com/u/36352093?v=4)](https://github.com/GuySartorelli "GuySartorelli (312 commits)")[![sig-sam](https://avatars.githubusercontent.com/u/25677215?v=4)](https://github.com/sig-sam "sig-sam (5 commits)")[![sig-steve](https://avatars.githubusercontent.com/u/5545293?v=4)](https://github.com/sig-steve "sig-steve (1 commits)")

---

Tags

validatorvalidationsilverstripecmsajaxformvalidatorsfrontendFormsdependentwarningelementalcomposablerequiredCompositeValidator

### Embed Badge

![Health badge](/badges/guysartorelli-silverstripe-composable-validators/health.svg)

```
[![Health](https://phpackages.com/badges/guysartorelli-silverstripe-composable-validators/health.svg)](https://phpackages.com/packages/guysartorelli-silverstripe-composable-validators)
```

###  Alternatives

[proengsoft/laravel-jsvalidation

Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest

1.1k2.3M49](/packages/proengsoft-laravel-jsvalidation)[barbieswimcrew/zip-code-validator

Constraint class for international zipcode validation

772.3M](/packages/barbieswimcrew-zip-code-validator)[sheadawson/silverstripe-zenvalidator

Faster, easier client and server-side form validation for SilverStripe

5778.4k2](/packages/sheadawson-silverstripe-zenvalidator)

PHPackages © 2026

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