PHP code example of nanayawkumi / nyk-input-validator
1. Go to this page and download the library: Download nanayawkumi/nyk-input-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/ */
nanayawkumi / nyk-input-validator example snippets
use Nanayawkumi\InputValidator\Rules\Username;
use Nanayawkumi\InputValidator\Rules\Email;
use Nanayawkumi\InputValidator\Rules\GhPhone;
use Nanayawkumi\InputValidator\Rules\SecureUrl;
$request->validate([
'username' => ['
use Nanayawkumi\InputValidator\Casts\GhPhoneCast;
use Nanayawkumi\InputValidator\Casts\SanitizedCast;
protected function casts(): array
{
return [
'phone' => GhPhoneCast::class, // or GhPhoneCast::class.':e164'
'username' => SanitizedCast::class.':username',
'email' => SanitizedCast::class.':email',
'ghana_card' => SanitizedCast::class.':ghana_card',
];
}
use Nanayawkumi\InputValidator\Livewire\SanitizesInputs;
class RegisterForm extends Component
{
use SanitizesInputs;
public string $username = '';
public string $email = '';
protected function inputSanitizers(): array
{
return [
'username' => 'username',
'email' => 'email',
];
}
protected function rules(): array
{
return [
'username' => ['
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.