Laravel Extended Validator

I released my first Laravel 4 package today, which is a couple of classes that build on top of Laravel’s Validator library.

Take a look at this snippet, then view the project on Github to see how it can assist your validation.

The main reasons I created this package are:

  1. To ease the creation of validation services – we all know validaton should be moved out of the controller
  2. Provide an easy way to provide context for validations – such as providing a modified set of validation rules for edit vs. create
  3. Provide an easy way to group validations – that is, calling one ‘passes()’ method to validate multiple models

It is documented on Github and I’ll write a more in depth blog post about it in the near future.

For now, visit the project on Github!

  • Erik

    Very nice. Checking it out on GitHub now. I also ran into the issue of differing rules for edit/create (which you solved with contexts) when adopting a similar approach I modified from some approaches Laracasts laid out.

    I like your groupedValidator approach also. I know I’ve run into a few situations where I end up with several “Validate A … then B …” code blocks. Thanks for putting this together!

    • crhayes

      Awesome, thanks for the comment Erik!