Added vendor/ directory for Composer's installed files

This commit is contained in:
Ascendings
2015-08-30 12:33:20 -04:00
parent 45df179c49
commit b66a773ed8
1162 changed files with 112457 additions and 0 deletions

View File

@ -0,0 +1,32 @@
<?php
/**
* Violin example. Custom rule.
*
* Creating a custom rule using the addRule method, passing in a
* closure which should return false if the check has failed,
* or true if the check has passed.
*/
require '../vendor/autoload.php';
use Violin\Violin;
$v = new Violin;
$v->addRuleMessage('startsWithNumber', 'The {field} must start with a number.');
$v->addRule('startsWithNumber', function($value, $input, $args) {
$value = trim($value);
return is_numeric($value[0]);
});
$v->validate([
'username' => ['dale', 'required|min(3)|max(20)|startsWithNumber']
]);
if ($v->passes()) {
// Passed
} else {
var_dump($v->errors()->all());
}

View File

@ -0,0 +1,35 @@
<?php
/**
* Violin example. Custom rule.
*
* Creating a custom rule using the addRule method, passing in a
* closure which should return false if the check has failed,
* or true if the check has passed.
*
* This example shows the use of arguments that can be used
* to make rules that require arguments.
*/
require '../vendor/autoload.php';
use Violin\Violin;
$v = new Violin;
$v->addRuleMessage('startsWith', 'The {field} must start with "{$0}".');
$v->addRule('startsWith', function($value, $input, $args) {
$value = trim($value);
return $value[0] === $args[0];
});
$v->validate([
'username' => ['dale', 'required|min(3)|max(20)|startsWith(a)']
]);
if ($v->passes()) {
// Passed
} else {
var_dump($v->errors()->all());
}