Validation

A simple but powerful Validation Engine, in a Laravel-esque style.

Its Validation Rules and the basic usage are similar with Illuminate\Validation v4.x, but no Files Validation support.

To note that it use the new Database API for verification of data presence into Database. Then, if you use this Validation, is a must to use also the new Database API in the entire application, and NOT the variant given by Helpers\Database.

Also to note that for the translation of error messages, it use the new Language API.

The Validation usage is simple, as in the following example:

use Validator;

$data = array(
'username' => 'michael',
'password' => 'password',
'email' => 'michael@novaframework.dev'
); $rules = array(
'username' => 'required|min:3|max:50|alpha_dash|unique:users',
'password' => 'required|between:4,30',
'email' => 'required|email|max:100|unique:users',
); $validator = Validator::make($data, $rules); if ($validator->passes()) {
echo '<h3>Data validated with success!</h3>'; echo '<pre>' .var_export($data, true) .'</pre>';
} else {
$errors = $validator->errors()->all(); echo '<pre>' .var_export($errors, true) .'</pre>';
}

最新文章

  1. ssh登录 The authenticity of host 192.168.0.xxx can&#39;t be established. 的问题
  2. Xamarin Error cannot find &lsquo;aapt.exe&rsquo;
  3. kafka模块概述
  4. Java中封装、继承和多态
  5. 关于VS打包程序无法弹出主界面的问题
  6. android打开,保存图片到sd卡,显示图片
  7. C++学习38 string字符串的增删改查
  8. 动态生成C# Lambda表达式
  9. flappy pig小游戏源码分析(3)——解剖util
  10. 连接MySQL数据库得到错误&ldquo;Unable to find the requested .Net Framework Data Provider&rdquo;
  11. PHP 进行统一邮箱登陆的代理实现(swoole)
  12. chage命令管理用户口令时效
  13. JS HTML DOM
  14. Rsync、Unison及DRBD的比较
  15. 在web中使用HTTPS
  16. Qt Creator 整合 python 解释器教程
  17. Android 开发使用第三方库出现Crash时处理方案汇总
  18. flask中缓存cache导入时引发的错误
  19. JQUERY-自定义插件-ajax-跨域访问
  20. zookeeper的监控

热门文章

  1. table点击一行显示下一行的特效
  2. FZU 2105-Digits Count(线段树延时标记)
  3. Python脚本控制的WebDriver 常用操作 &lt;五&gt; 访问链接
  4. 绕过CDN查找网站真实IP方法
  5. 【译】 AWK教程指南 7AWK应用实例
  6. 在PHPmyadmin中删除数据库
  7. HW6.22
  8. ffmpeg 的tutorial
  9. 谷歌官方刷新组件SwipeRefreshLayout
  10. hdu 5504 GT and sequence