PHPackages                             jcaillot/laminas-before-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. jcaillot/laminas-before-validator

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

jcaillot/laminas-before-validator
=================================

Laminas Validator; Let you compare two date strings

v1.1(4y ago)06MITPHPPHP ^7.4 || ~8.0.0

Since Oct 12Pushed 4y ago1 watchersCompare

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

READMEChangelog (1)Dependencies (6)Versions (3)Used By (0)

jcaillot/laminas-before-validator
=================================

[](#jcaillotlaminas-before-validator)

### Date Before validator for the Laminas framework

[](#date-before-validator-for-the-laminas-framework)

> Laminas\\Validator\\GreaterThan supports only the validation of numbers. This simple custom Validator, will let you compare two date strings.

Installation
------------

[](#installation)

`composer require jcaillot/laminas-before-validator`

Usage
-----

[](#usage)

The validator needs to know the name of the other date field for comparison. It needs to know the input date format. Here are the three required options:

- *second\_date\_field* (default to endDate): The name the second date field.
- *date\_format* (default to Y-m-d H:i:s): the string format for the two dates.
- *strict* (default to false): will allow two identical dates to validate.

Add Validator as usual in your fieldset:

```
    use Laminas\Form\Fieldset;
    use Laminas\InputFilter\InputFilterProviderInterface;
    use Chaman\Validator\BeforeValidator;

    class DemoFieldset extends Fieldset implements InputFilterProviderInterface
    {

       ...

       public function getInputFilterSpecification(): array
        {
            return [
                // date1
                'date1' => [
                    'required' => true,
                    'filters' => [
                        ['name' => 'StringTrim'],
                        ['name' => 'StripTags'],
                    ],
                    'validators' => [
                        [
                            'name' => 'NotEmpty',
                            'break_chain_on_failure' => true
                        ],
                        [
                            'name' => BeforeValidator::class,
                            'options' => [
                                'second_date_field' => 'date2',
                                'date_format'       => 'Y-m-d',
                                'strict'            => true,
                                'messages' => [
                                    BeforeValidator::NOT_BEFORE => '"%value%" should be before the second date.',
                                    BeforeValidator::NOT_A_VALID_DATE => '"%value%" is not a valid date.',
                                ],
                            ]
                        ]
                    ],
                ],
                // date2
                'date2' => [
                    'required' => true,
                    'filters' => [
                        ['name' => 'StringTrim'],
                        ['name' => 'StripTags'],
                    ],
                    'validators' => [
                        [
                            'name' => 'NotEmpty',
                            'break_chain_on_failure' => true
                        ],
                    ],
                ],
            ];

        }

        ...
```

License
-------

[](#license)

[MIT](https://choosealicense.com/licenses/mit/)

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 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

1674d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/55d128e145861bd2b84352101807005a5c1bca03fdced11b251c6c4e5855d102?d=identicon)[jcaillot](/maintainers/jcaillot)

---

Top Contributors

[![jcaillot](https://avatars.githubusercontent.com/u/22201753?v=4)](https://github.com/jcaillot "jcaillot (3 commits)")

---

Tags

laminasvalidatordate

###  Code Quality

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/jcaillot-laminas-before-validator/health.svg)

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

###  Alternatives

[laminas/laminas-validator

Validation classes for a wide range of domains, and the ability to chain validators to create complex validation criteria

15544.9M188](/packages/laminas-laminas-validator)[laminas/laminas-form

Validate and display simple and complex forms, casting forms to business objects and vice versa

8112.0M115](/packages/laminas-laminas-form)[laminas/laminas-inputfilter

Normalize and validate input sets from the web, APIs, the CLI, and more, including files

4614.4M97](/packages/laminas-laminas-inputfilter)[laminas/laminas-captcha

Generate and validate CAPTCHAs using Figlets, images, ReCaptcha, and more

2318.5M43](/packages/laminas-laminas-captcha)[penance316/laravel-iso8601-validator

laravel iso8601 date validation package

18613.9k](/packages/penance316-laravel-iso8601-validator)[san/san-captcha

Laminas Sample For Captcha

106.5k](/packages/san-san-captcha)

PHPackages © 2026

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