PHP code example of jcaillot / laminas-before-validator

1. Go to this page and download the library: Download jcaillot/laminas-before-validator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jcaillot / laminas-before-validator example snippets

 

    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' => [
                    '     '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' => [
                    '