2017 © Pedro Peláez
 

library validation-parser

image

ifnot/validation-parser

  • Thursday, June 9, 2016
  • by ifnot
  • Repository
  • 1 Watchers
  • 0 Stars
  • 272 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

ValidationParser

Simple Laravel validation rule parser for : auto-generate forms, auto-generate documentations etc ... from a simple Laravel Validation array., (*1)

Compatible with Laravel 4 and Laravel 5, (*2)

Installation

composer require "ifnot/validation-parser"

Custom usage

In this example we will call the RuleSet parser with a custom view for rendering an automatic Form., (*3)

In the Controller Action / Route, we define witch view using for each field :, (*4)

Ifnot\ValidationParser\RuleSet::$view = 'my.form.field';
return View::make('my.form.show');

In /view/my/form/show.blade.php we loop on each RuleSets and bind the property to the RuleSet view., (*5)

@foreach([
  "email":"required|email",
  "civility":"required|in:M,F",
  "comment":"string"
] as $property => $rules)
  {{ \Ifnot\ValidationParser\RuleSet::parse($rules)->bind('property' => $property)->toString() }}
@endforeach

In the RuleSet view /views/my/form/field.blade.php (specified before) :, (*6)

<label>{{ $property }}</label>
@if($ruleSet->isBoolean())
  {{-- Here insert a input type radio --}}
@elseif($ruleSet->isIn())
  {{-- Here, you can insert a select with $ruleSet['in']->params witch contains an array of allowed values --}}
@elseif($field->isExists())
  {{-- Here a ajax loaded json from your table $ruleSet['in']->params[0] and the column $ruleSet['in']->params[1] --}}
@endif

The Versions

09/06 2016

dev-master

9999999-dev

  Sources   Download

The Requires

 

The Development Requires

by Anael Favre

27/04 2016

0.4.2.1

0.4.2.1

  Sources   Download

The Requires

 

The Development Requires

by Anael Favre

15/06 2015

0.4.2.0

0.4.2.0

  Sources   Download

The Requires

 

The Development Requires

by Anael Favre