PHP code example of phpviet / symfony-validation

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

    

phpviet / symfony-validation example snippets


// config/bundles.php

return [
    .....
    PHPViet\Symfony\Validation\Bundle::class => ['all' => true]
];


    use PHPViet\Symfony\Validation\Constraints\MobileVN as AssertMobileVN;

    /**
     * @AssertMobileVN
     */
    private $mobileNumber;

    use PHPViet\Symfony\Validation\Constraints\LandLineVN as AssertLandLineVN;

    /**
     * @AssertLandLineVN
     */
    private $landLineNumber;

    use PHPViet\Symfony\Validation\Constraints\IdVN as AssertIdVN;

    /**
     * @AssertIdVN
     */
    private $idVN;

    use PHPViet\Symfony\Validation\Constraints\IpVN as AssertIpVN;

    /**
     * @AssertIpVN
     */
    private $ipVN;
    
    /**
     * @AssertIpVN(version=4)
     */
    private $ipv4VN;    
    
    /**
     * @AssertIpVN(version=6)
     */
    private $ipv6VN;