chickentikkamasala/laravalidator
Larablocks Analysis
chickentikkamasala/laravalidator works with any PHP project: the latest release (0.2, Jun 25, 2017) doesn't depend on Laravel.
Recommendation checks
Not advisedNot advised: no release or commit in over 2 years.
- No release or commit in over 2 years
- No release in the last 12 months (last: Jun 25, 2017)
- 0 downloads a month (needs 10,000)
- 1 GitHub star (needs 100)
State
Likely abandoned- No release or commit in over 2 years.
- Last stable release: Jun 25, 2017.
- No releases in the last 12 months.
- First released: Jun 25, 2017.
- 0 open issues on GitHub.
Data from Packagist and GitHub, checked by Larablocks on Nov 28, 2026.
| Install | |
|---|---|
composer require chickentikkamasala/laravalidator |
|
| Latest Version: | 0.2 |
| PHP: | >=7.0 |
| Last Updated: | Jun 25, 2017 |
| Links: | GitHub · Packagist |
Installation
Add the service provider to your providers array in config/app.php
'providers' => [
...
ChickenTikkaMasala\LaraValidator\ValidatorServiceProvider::class,
...
];
Now create a class that extends AbstractValidator in App\Validators;
<?php
namespace App\Validators;
use \ChickenTikkaMasala\LaraValidator\Validators\AbstractValidator;
class CustomValidator extends AbstractValidator
{
public $name = 'custom';
public function execute($attribute, $value, array $parameters, $validator) : boolean {
return true;
}
public function message($message, $attribute, $rule, array $parameters) : string {
return 'your custom validation failed';
}
}
Now use your custom validation like
public $rules = [
'field' => 'custom',
];
Validating parameters
I've added a small exception throwing function that 'validates' the parameters passed.
public function execute($attribute, $value, array $parameters, $validator) : boolean {
$this->validateParameters($parameters, [
0 => 'table name',
]);
}
Now if we did this with our custom validator
public $rules = [
'field' => 'custom',
];
We would get an exception
RequiredParameterException in AbstractValidator.php line 40:
The parameter "table name" is required.
Make function
You can use the make:validator command to create a new validator class
php artisan make:validator CustomValidator
And that's pretty much it! It's the simple things ;)
Related Packages
Version History
| Version | Released | PHP | License |
|---|---|---|---|
| 0.2 | >=7.0 | ||
| 0.1 | >=7.0 |