PHP code example of edsonr-coosta / validator
1. Go to this page and download the library: Download edsonr-coosta/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/ */
edsonr-coosta / validator example snippets
use Negotel\Validators\Validator;
// Seus dados de exemplo
$data = (object) [
'name' => 'John Doe',
'email' => 'johnexample.com',
// Outros campos aqui
];
try {
// Crie uma instância do Validator para um campo específico
$isName = Validator::when($data, 'name');
$isEmail = Validator::when($data, 'email');
// Marque o campo como obrigatório
$isName->sage();