Romanian CNP validator for Laravel

v9.0.2 2022-03-04 08:43 UTC


CNP Validator

Codacy Badge StyleCI License Total Downloads Latest Stable Version

Romanian CNP validator for Laravel

Instalation Steps

  1. Add 'LaravelLiberu\CnpValidator\CnpValidatorServiceProvider::class' to your providers list in config/app.php.

  2. Use the CNP validator in your ValidateModelRequest validation class

    public function rules()
        return [
            'cnp' => [
                    request()->getMethod() == 'PATCH'
                        ? Rule::unique('users', 'nin')->ignore(route('user')->id)
                        : Rule::unique('users', 'nin')


Don't forget to add the translation for the validator error message in resources/lang/**/validation.php under the cnp key.

The Laravel Liberu Core package comes with this package included.


are welcome. Pull requests are great, but issues are good too.


This package is released under the MIT license.