PHP code example of purpledot / validation-bundle

1. Go to this page and download the library: Download purpledot/validation-bundle 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/ */

    

purpledot / validation-bundle example snippets


use PurpleDot\ValidationBundle\Validator\Constraints as PurpleDotAssert;

// ...

#[PurpleDotAssert\PolishIdCardNumber]
private ?string $idCardNUmber = null;

use PurpleDot\ValidationBundle\Validator\Constraints as PurpleDotAssert;

// ...

#[PurpleDotAssert\PolishMobilePhone]
private ?string $phoneNumber;

use PurpleDot\ValidationBundle\Validator\Constraints as PurpleDotAssert;

// ...

#[PurpleDotAssert\PolishTaxNumber]
private ?string $taxNumber;

$this->taxNumber = 'PL7746249830' // valid
$this->taxNumber = '7746249830' // valid 

use PurpleDot\ValidationBundle\Validator\Constraints as PurpleDotAssert;

// ...

#[PurpleDotAssert\PolishTaxNumber(

use PurpleDot\ValidationBundle\Validator\Constraints as PurpleDotAssert;

// ...

#[PurpleDotAssert\PolishTaxNumber(allowPrefix: false)]
private ?string $taxNumber;

$this->taxNumber = '7746249830' // valid 
$this->taxNumber = 'PL7746249830' // invalid

use PurpleDot\ValidationBundle\Validator\Constraints as PurpleDotAssert;

// ...

#[PurpleDotAssert\Pesel]
private ?string $pesel = null;