PHP code example of thomas-omweri / laravel-multi-validator
1. Go to this page and download the library: Download thomas-omweri/laravel-multi-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/ */
thomas-omweri / laravel-multi-validator example snippets
//use LaravelMultiValidator\Rules\AnyOf;
//use LaravelMultiValidator\Rules\OrRule;
$validator = Validator::make(
[
'name' => 'Thomas Omweri',
'contact' => '+2547xxxxxxxx'
],
[
'name' => [
new orRule('starts_with:Thomas', 'ends_with:Omweri'),
],
'contact' => [
new anyOf(
[
'email',
Rule::phone()->country('KE')->mobile(),
Rule::phone()->country('KE')->fixed()
]
),
],
]
);