PHP code example of ekut / spatie-dto-validators
1. Go to this page and download the library: Download ekut/spatie-dto-validators 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/ */
ekut / spatie-dto-validators example snippets
use Ekut\SpatieDtoValidators\MinLength;
use Spatie\DataTransferObject\DataTransferObject;
class Foo extends DataTransferObject
{
#[MinLength(10)]
public ?string $property1;
#[GreaterThan(10)]
public ?int $property2;
}
#[Blank()]
#[NotBlank(true|false)]
#[NotNull()]
#[IsNull()]
#[IsTrue()]
#[IsFalse()]
#[MinLength(3)]
#[MaxLength(3)]
#[Email()]
#[Url()]
#[EqualTo(3)]
#[EqualTo(3)]
#[IdenticalTo(3)]
#[NotIdenticalTo(3)]
#[LessThan(3)]
#[LessThanOrEqual(3)]
#[GreaterThan(3)]
#[GreaterThanOrEqual(3)]
#[DivisibleBy(3)]
#[DivisibleBy(0.35)]
#[Choice([0, '1', false])]