PHP code example of esteveli / spain-validator
1. Go to this page and download the library: Download esteveli/spain-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/ */
esteveli / spain-validator example snippets
namespace App\Entity;
// Validación extra, telefono, DNI/NIF...
use Esteveli\SpainValidator\Validator\Constraints as SpainValidator;
class MyEntity {
#[SpainValidator\AllPhone]
private string $telefono;
#[Assert\Length(max: 9)]
#[SpainValidator\Phone]
private string $telefonoFijo;
#[Assert\Length(max: 9)]
#[SpainValidator\MobilePhone]
private $telefonoMovil;
#[SpainValidator\ZipCode]
private $codigoPostal;
#[SpainValidator\DniCif]
private $dniCif;
#[SpainValidator\Dni]
private $dni;
#[SpainValidator\Cif]
private $cif;
# Getters and setters ....
}