sukohi/array-validator
Larablocks Analysis
sukohi/array-validator works with Laravel 5 (latest release 1.0.2, Oct 29, 2015), which reached end of life: no more fixes, even for security.
Recommendation checks
Not advisedNot advised: no release or commit in over 2 years.
- No release or commit in over 2 years
- Supports only Laravel 5, past end of life
- No release in the last 12 months (last: Oct 29, 2015)
- 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: Oct 29, 2015.
- No releases in the last 12 months.
- First released: Oct 29, 2015.
- 0 open issues on GitHub.
Data from Packagist and GitHub, checked by Larablocks on Nov 27, 2026.
| Install | |
|---|---|
composer require sukohi/array-validator |
|
| Latest Version: | 1.0.2 |
| Laravel: | 5 |
| License: | MIT |
| Last Updated: | Oct 29, 2015 |
| Links: | GitHub · Packagist |
ArrayValidator
A Laravel package to manage validation for array values.
Installation
Add this package name in composer.json
"require": {
"sukohi/array-validator": "1.*"
}
Execute composer command.
composer update
#Usage
Make your own Request using the following command.
php artisan make:request *****Request
- see here for the details
Set ArrayValidator the Request class like this.
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Sukohi\ArrayValidator\ArrayValidatorTrait;
class YourRequest extends Request
{
use ArrayValidatorTrait;
// Something..
}
Now your Request class can manage array validation. So add your validation rules there as usual.
public function rules()
{
return [
'emails' => 'required|email'
];
}
Set Attribute
You also can set attribute names as usual.
{key} will be replaced with array key like 0, 1, 2, key.
public function attributes() {
return [
'titles' => 'Title - {key}'
];
}
Get Error Message
(in Blade)
{{ $errors->first('titles.0') }}
{{ $errors->first('titles.1') }}
{{ $errors->first('titles.2') }}
{{ $errors->first('titles.key') }}
Note
If you use Collective package, you need to set input names like this.
{!! Form::text('titles[0]') !!}<br>
{!! Form::text('titles[1]') !!}<br>
{!! Form::text('titles[2]') !!}<br>
{!! Form::text('titles[key]') !!}
HTML Example
<!-- Errors -->
@if($errors->first('titles.0'))
{{ $errors->first('titles.0') }}<br>
@endif
@if($errors->first('titles.1'))
{{ $errors->first('titles.1') }}<br>
@endif
@if($errors->first('titles.2'))
{{ $errors->first('titles.2') }}<br>
@endif
@if($errors->first('titles.key'))
{{ $errors->first('titles.key') }}<br>
@endif
<!-- Form -->
{!! Form::open(['route' => 'YOUR-ROUTE']) !!}
{!! Form::text('titles[0]') !!}<br>
{!! Form::text('titles[1]') !!}<br>
{!! Form::text('titles[2]') !!}<br>
{!! Form::text('titles[key]') !!}
<button type="submit">Submit</button>
{!! Form::close() !!}
License
This package is licensed under the MIT License.
Copyright 2015 Sukohi Kuhoh
Related Packages
Powerful PHP database abstraction layer (DBAL) with many features for database s...
Laravel Serializable Closure provides an easy and secure way to serialize closur...
Cli error handling for console/command-line PHP applications.
Version History
| Version | Released | Laravel | License |
|---|---|---|---|
| 1.0.2 | ~5.0 | MIT | |
| 1.0.1 | ~5.0 | MIT | |
| 1.0.0 | ~5.0 |