1. Go to this page and download the library: Download milwad/laravel-validate 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/ */
milwad / laravel-validate example snippets
>= 8.0
/*
* If you want to use rules like '
'phone_number' => '
use Milwad\LaravelValidate\Rules\ValidPhoneNumber;
return [
'phone' => ['
namespace App\Validators;
use Milwad\LaravelValidate\Utils\CountryPhoneValidator;
class CustomPhoneValidator implements CountryPhoneValidator
{
/**
* Validate the phone number for the custom country.
*/
public function validate(string $phoneNumber): bool
{
// Implement the phone number validation logic for your country
// Example: Check if the phone number matches a specific pattern
return preg_match('/^\+1234\d{10}$/', $phoneNumber);
}
}