Bouncer is a library that allows you to flexible, quickly and easy to use filter and validate HTML forms.
new Bouncer( string|array|object $data = '', array $options = array() )$data(string|array|object) (Optional) Accepts array, object or query string. The array key is treated as the value pair field and its value. Thus, it is capable of accepting requests such as$_POST,$_GET.$options(array) (Optional) Accepts arrays to overwrite default variables.
BouncerBouncer instance.
$variables = array(
'messages' => array(
'required' => 'Please fill in the blank fields'
)
);
$bouncer = new Bouncer($_POST, $variables);$myData = array(
'name' => 'John',
'surname' => 'Doe',
'email' => 'johndoe@example.tld'
);
$bouncer = new Bouncer($myData);$bouncer = new Bouncer('name=John&surname=Doe&email=johndoe@example.tld');Bouncer comes with rule labels and error messages by default. You can change these variables in the settings while taking a instance.
Tip: Use this feature if you just want to change the defaults. At the Bouncer, each rule of each field allows you to add custom error messages.
$variables = array(
'messages' => array(
'required' => 'Please fill in the blank fields'
)
);
$bouncer = new Bouncer($_POST, $variables);$defaults = array(
'messages' => array(
'default' => '%label% contains %rule% rule error.',
'empty' => '%label% must be left blank.',
'required' => '%label% must be filled in.',
'length' => '%label% has to be %argument1% characters long.',
'minlength' => '%label% must be at least %argument1% characters or longer.',
'maxlength' => '%label% must be no longer than %argument1% characters.',
'betweenlength' => '%label% has to be between %argument1% and %argument2% characters long.',
'min' => '%label% must be greater than or equal to %argument1%.',
'max' => '%label% must be less than or equal to %argument1%.',
'between' => '%label% must be a number between %argument1% and %argument2%',
'email' => '%label% must be valid email address.',
'boolean' => '%label% must be valid boolean value.',
'float' => '%label% must be valid floating point numbers.',
'integer' => '%label% must be valid integer number.',
'digits' => '%label% must be valid integer number.',
'even' => '%label% must be an even number.',
'odd' => '%label% must be an odd number.',
'matches' => '%label% must be the same as "%argument1%".',
'notmatches' => '%label% must be different from "%argument1%".',
'startswith' => '%label% must start with "%argument1%".',
'notstartswith' => '%label% must not start with "%argument1%".',
'endswith' => '%label% must be end with "%argument1%".',
'notendswith' => '%label% must be not end with "%argument1%".',
'oneof' => '%label% must be one of the allowed "%argument1%".',
'notoneof' => '%label% must be not one of the disallowed "%argument1%".',
'ip' => '%label% must be valid IP address.',
'url' => '%label% must be valid internet address "URL".',
'ccnum' => '%label% must be valid credit card number.',
'callback' => '%label% must conform to the required format.',
'tcnum' => '%label% must be valid Turkish Republic identification number.',
),
'rules' => array(
'labels' => array(
'default' => '(Unknown)',
'empty' => '(Must empty value)',
'required' => '(Must required)',
'length' => '(Invalid length)',
'minlength' => '(Invalid Minimum length)',
'maxlength' => '(Invalid Maximum length)',
'betweenlength' => '(Invalid length range)',
'min' => '(Invalid minimum number)',
'max' => '(Invalid maximum number)',
'between' => '(Invalid number range)',
'email' => '(Invalid email address)',
'boolean' => '(Must boolean value)',
'float' => '(Must float number)',
'integer' => '(Must integer number)',
'digits' => '(Must integer number)',
'even' => '(Must even number)',
'odd' => '(Must odd number)',
'matches' => '(Must matches with ...)',
'notmatches' => '(Must not match with ...)',
'startswith' => '(Must starts with ...)',
'notstartswith' => '(Must not starts with ...)',
'endswith' => '(Must ends with ...)',
'notendswith' => '(Must not ends with ...)',
'oneof' => '(Must one of allowed)',
'notoneof' => '(It shouldn\'t be one of disallowed)',
'ip' => '(Invalid IP address)',
'url' => '(Invalid internet address)',
'ccnum' => '(Invalid credit card number)',
'tcnum' => '(Invalid Turkish Republic identification number)',
)
)
);name()- Sets the current field.label()- Defines the label of the field.value()- Defines the value of the field.validate()- Validates existing, preset or all fields.get()- Returns the values of the specified properties.errors()- Outputs error messages as HTML.empty()- Field should not be filled.required()- Field must be filled in.length()- Field has to be X characters long.minlength()- Field has to be greater than or equal to X characters long.maxlength()- Field has to be less than or equal to X characters long.betweenlength()- Field has to be between minlength and maxlength characters long.min()- Field must be a number greater than [or equal to] X.max()- Field must be a number less than [or equal to] X.between()- Field must be a number between X and Y.boolean()- Field must be a valid boolean value.integer()- Field must be a valid integer value.digits()- Field must be a valid digits.float()- Field must be a valid float number.numeric()- Field must be a valid numeric value.even()- Field must be an even number.odd()- Field must be an odd number.matches()- Field must match a specific value.notmatches()- Field must differ from a specific value.startswith()- Field must start with a specific substring.notstartswith()- Field must NOT start with a specific substring.endswith()- Field must end with a specific substring.notendswith()- Field must NOT end with a specific substring.oneof()- Field has to be one of the allowed ones.notoneof()- Field has to be not one of the disallowed ones.email()- Field must be a valid email address.ip()- Field must be valid IP address.url()- Field must be valid internet address.color()- Field must be valid hexadecimal color code.ccnum()- Field must be a valid credit card number format.tcnum()- Field must be a valid Turkish Republic identification number.callback()- Add custom callable validation functionality.filter()- Filter before validating a field's value.
name( string $name )Sets the current field.
If the field is not predefined, it creates an empty one.
$name(string) Field name.
BouncerBouncer instance.
$bouncer = new Bouncer();
$bouncer
->name('field')
->value('Hello World!');$bouncer = new Bouncer(array(
'field' => 'Yes'
));
$bouncer
->name('field')
->value('No');label( string $label )Defines the label of the field.
Defines a label to the field that can be used as a variable in error messages.
$label(string) The label of the field.
BouncerBouncer instance.
$bouncer = new Bouncer(array(
'field' => 'Yes'
));
$bouncer
->name('field')
->label('Remember Me');value( string $value )Defines the value of the field.
If predefined, it overwrites the value. (see)
$value(string) The value of the field.
BouncerBouncer instance.
$bouncer = new Bouncer(array(
'field' => 'Yes'
));
$bouncer
->name('field')
->value('No');validate( boolean|string $name = '' )Validates existing, preset or all fields.
$name(boolean|string) (Optional) Field name. If true, validates all fields. If empty, validates preset field. The default is''.
mixedAll body data.
If it doesn't find any fields, it returns body data without validation.
$bouncer = new Bouncer($_POST);
$bouncer->validate(true);$bouncer = new Bouncer(array(
'author' => 'John',
'title' => 'Hello World!',
'content' => 'The quick, brown fox jumps over a lazy dog.',
'visibility' => ''
));
$bouncer->validate('visibility'); // Only validates the visibility field.get( string $property = '', string $name = '' )Returns the values of the specified properties.
Returns all data collected about the field or body, or the specified data.
$property(string) The property name. (see)$name(string) Field name. If empty, the whole body. The default is''.
mixedPreferred data.
$bouncer = new Bouncer(array(
'title' => 'Hello World!',
'content' => 'The quick, brown fox jumps over a lazy dog.'
));
$bouncer
->name('title')
->required()
->validate();
var_dump( $bouncer->get('valid', 'title') ); // returns 1
var_dump( $bouncer->get('valid') ); // Returns -1 because the body has fields that have not yet been validatederrors( mixed $options = array(), string $name = '' )$options(mixed) Options.
array(
'before' => '',
'after' => '',
'item_before' => '',
'item_after' => '',
'echo' => ''
);$name(string) Field name. If empty, the whole errors. The default is''.
mixedHTML output.
$bouncer = new Bouncer(array(
'title' => 'Hello World!',
'content' => 'The quick, brown fox jumps over a lazy dog.'
));
$bouncer
->name('title')
->required()
->minlength(100)
->name('content')
->required()
->minlength(900)
->validate();
$options = array(
'before' => '<ol>',
'after' => '</ol>',
'error_before' => '<li>',
'error_after' => '</li>'
);
$bouncer->errors($options, true);empty( boolean|string $message = true )Field should not be filled.
$message(boolean|string) (Optional) The error message that will appear. Nothing will appear if''is entered. Accepts allowed variables (See). Bool true shows the default message. The default is true.
BouncerBouncer instance.
$bouncer = new Bouncer(array(
'field' => 'Field value'
));
$bouncer
->name('field')
->empty('Please do not fill in this field.')
->validate();required( boolean|string $message = true )Field must be filled in.
It can also be called
notempty()to make it easier to use.
$message(boolean|string) (Optional) The error message that will appear. Nothing will appear if''is entered. Accepts allowed variables (See). Bool true shows the default message. The default is true.
BouncerBouncer instance.
$bouncer = new Bouncer(array(
'field' => ''
));
$bouncer
->name('field')
->required()
->validate();length( integer|string $length, boolean|string $message = true )Field has to be X characters long.
$length(integer|string) Character length.$message(boolean|string) (Optional) The error message that will appear. Nothing will appear if''is entered. Accepts allowed variables (See). Bool true shows the default message. The default is true.
BouncerBouncer instance.
$bouncer = new Bouncer(array(
'field' => 'Hello'
));
$bouncer
->name('field')
->length(4)
->validate();minlength( integer|string $minlength, boolean|string $message = true )Field has to be greater than or equal to X characters long.
$minlength(integer|string) Minimum character length.$message(boolean|string) (Optional) The error message that will appear. Nothing will appear if''is entered. Accepts allowed variables (See). Bool true shows the default message. The default is true.
BouncerBouncer instance.
$bouncer = new Bouncer(array(
'field' => 'Hello'
));
$bouncer
->name('field')
->minlength(10)
->validate();maxlength( integer|string $maxlength, boolean|string $message = true )Field has to be less than or equal to X characters long.
$maxlength(integer|string) Maximum character length.$message(boolean|string) (Optional) The error message that will appear. Nothing will appear if''is entered. Accepts allowed variables (See). Bool true shows the default message. The default is true.
BouncerBouncer instance.
$bouncer = new Bouncer(array(
'field' => 'Hello'
));
$bouncer
->name('field')
->maxlength(3)
->validate();betweenlength( integer|string $minlength, integer|string $maxlength, boolean|string $message = true )Field has to be between minlength and maxlength characters long.
$minlength(integer|string) Minimum character length.$maxlength(integer|string) Maximum character length.$message(boolean|string) (Optional) The error message that will appear. Nothing will appear if''is entered. Accepts allowed variables (See). Bool true shows the default message. The default is true.
BouncerBouncer instance.
$bouncer = new Bouncer(array(
'field' => 'Hello'
));
$bouncer
->name('field')
->betweenlength(1, 50, 'The field has an error in the number of characters')
->validate();min( integer|string $min, boolean|string $message = true )Field must be a number greater than [or equal to] X.
$min(integer|string) Minimum number.$message(boolean|string) (Optional) The error message that will appear. Nothing will appear if''is entered. Accepts allowed variables (See). Bool true shows the default message. The default is true.
BouncerBouncer instance.
$bouncer = new Bouncer(array(
'field' => '99'
));
$bouncer
->name('field')
->min(100, 'Error: This field can be a minimum of %argument1%.')
->validate();max( integer|string $max, boolean|string $message = true )Field must be a number less than [or equal to] X.
$max(integer|string) Maximum number.$message(boolean|string) (Optional) The error message that will appear. Nothing will appear if''is entered. Accepts allowed variables (See). Bool true shows the default message. The default is true.
BouncerBouncer instance.
$bouncer = new Bouncer(array(
'field' => '99'
));
$bouncer
->name('field')
->max(50, 'Error: This field can be a maximum of %argument1%.')
->validate();between( integer|string $min, boolean|string $max, boolean|string $message = true )Field must be a number between X and Y.
$min(integer|string) Minimum number.$max(integer|string) Maximum number.$message(boolean|string) (Optional) The error message that will appear. Nothing will appear if''is entered. Accepts allowed variables (See). Bool true shows the default message. The default is true.
BouncerBouncer instance.
$bouncer = new Bouncer(array(
'field' => '99'
));
$bouncer
->name('field')
->between(50, 60, 'This field should be between %argument1% and %argument2%.')
->validate();boolean( boolean|string $message = true )Field must be a valid boolean value.
$message(boolean|string) (Optional) The error message that will appear. Nothing will appear if''is entered. Accepts allowed variables (See). Bool true shows the default message. The default is true.
BouncerBouncer instance.
$bouncer = new Bouncer(array(
'field' => 'false'
));
$bouncer
->name('field')
->boolean()
->validate();integer( boolean|string $message = true )Field must be a valid integer value.
$message(boolean|string) (Optional) The error message that will appear. Nothing will appear if''is entered. Accepts allowed variables (See). Bool true shows the default message. The default is true.
BouncerBouncer instance.
$bouncer = new Bouncer(array(
'field' => '5'
));
$bouncer
->name('field')
->integer('Please enter a valid integer value.')
->validate();digits( boolean|string $message = true )Field must be a valid digits.
This is just like integer(), except there is no upper limit.
$message(boolean|string) (Optional) The error message that will appear. Nothing will appear if''is entered. Accepts allowed variables (See). Bool true shows the default message. The default is true.
BouncerBouncer instance.
$bouncer = new Bouncer(array(
'field' => '3e2'
));
$bouncer
->name('field')
->digits('Please enter a valid digits.')
->validate();float( boolean|string $message = true )Field must be a valid float number.
$message(boolean|string) (Optional) The error message that will appear. Nothing will appear if''is entered. Accepts allowed variables (See). Bool true shows the default message. The default is true.
BouncerBouncer instance.
$bouncer = new Bouncer(array(
'field' => '25.5'
));
$bouncer
->name('field')
->float()
->validate();numeric( boolean|string $message = true )Field must be a valid numeric value.
$message(boolean|string) (Optional) The error message that will appear. Nothing will appear if''is entered. Accepts allowed variables (See). Bool true shows the default message. The default is true.
BouncerBouncer instance.
$bouncer = new Bouncer(array(
'field' => '56.6e3'
));
$bouncer
->name('field')
->numeric()
->validate();even( boolean|string $message = true )Field must be an even number.
$message(boolean|string) (Optional) The error message that will appear. Nothing will appear if''is entered. Accepts allowed variables (See). Bool true shows the default message. The default is true.
BouncerBouncer instance.
$bouncer = new Bouncer(array(
'field' => '71'
));
$bouncer
->name('field')
->even()
->validate();odd( boolean|string $message = true )Field must be an odd number.
$message(boolean|string) (Optional) The error message that will appear. Nothing will appear if''is entered. Accepts allowed variables (See). Bool true shows the default message. The default is true.
BouncerBouncer instance.
$bouncer = new Bouncer(array(
'field' => '92'
));
$bouncer
->name('field')
->odd()
->validate();matches( string $string, boolean|string $message = true )Field must match a specific value (password comparison etc).
It can also be called
equal()to make it easier to use.
$string(string) String to match.$message(boolean|string) (Optional) The error message that will appear. Nothing will appear if''is entered. Accepts allowed variables (See). Bool true shows the default message. The default is true.
BouncerBouncer instance.
$bouncer = new Bouncer(array(
'field' => 'Hello World!'
));
$bouncer
->name('field')
->matches('Hello Bouncer!', 'Field does not match "%argument1%".')
->validate();notmatches( string $string, boolean|string $message = true )Field must differ from a specific value.
It can also be called
notequal()to make it easier to use.
$string(string) String to match.$message(boolean|string) (Optional) The error message that will appear. Nothing will appear if''is entered. Accepts allowed variables (See). Bool true shows the default message. The default is true.
BouncerBouncer instance.
$bouncer = new Bouncer(array(
'field' => 'Hello World!'
));
$bouncer
->name('field')
->matches('Hello World!', 'Field should not match "%argument1%".')
->validate();startswith( string $string, boolean|string $message = true )Field must start with a specific substring.
$string(string) String to match.$message(boolean|string) (Optional) The error message that will appear. Nothing will appear if''is entered. Accepts allowed variables (See). Bool true shows the default message. The default is true.
BouncerBouncer instance.
$bouncer = new Bouncer(array(
'field' => 'Hello World!'
));
$bouncer
->name('field')
->startswith('Hi')
->validate();notstartswith( string $string, boolean|string $message = true )Field must NOT start with a specific substring.
$string(string) String to match.$message(boolean|string) (Optional) The error message that will appear. Nothing will appear if''is entered. Accepts allowed variables (See). Bool true shows the default message. The default is true.
BouncerBouncer instance.
$bouncer = new Bouncer(array(
'field' => 'Hello World!'
));
$bouncer
->name('field')
->notstartswith('H')
->validate();endswith( string $string, boolean|string $message = true )Field must end with a specific substring.
$string(string) String to match.$message(boolean|string) (Optional) The error message that will appear. Nothing will appear if''is entered. Accepts allowed variables (See). Bool true shows the default message. The default is true.
BouncerBouncer instance.
$bouncer = new Bouncer(array(
'field' => 'Hello World!'
));
$bouncer
->name('field')
->endswith('.')
->validate();notendswith( string $string, boolean|string $message = true )Field must NOT end with a specific substring.
$string(string) String to match.$message(boolean|string) (Optional) The error message that will appear. Nothing will appear if''is entered. Accepts allowed variables (See). Bool true shows the default message. The default is true.
BouncerBouncer instance.
$bouncer = new Bouncer(array(
'field' => 'Hello World!'
));
$bouncer
->name('field')
->notendswith('World!')
->validate();oneof( string|array $allowed, boolean|string $message = true )Field has to be one of the allowed ones.
$allowed(string|array) Allowed list. Use an array or separate the words with commas. If you don't want the space to be included in the match, don't add spaces between them.$message(boolean|string) (Optional) The error message that will appear. Nothing will appear if''is entered. Accepts allowed variables (See). Bool true shows the default message. The default is true.
BouncerBouncer instance.
$bouncer = new Bouncer(array(
'field' => 'Hello World!'
));
$bouncer
->name('field')
->oneof('Hello Guys!,Hi World!')
->validate();notoneof( string|array $disallowed, boolean|string $message = true )Field has to be not one of the disallowed ones.
$disallowed(string|array) Disallowed list. Use an array or separate the words with commas. If you don't want the space to be included in the match, don't add spaces between them.$message(boolean|string) (Optional) The error message that will appear. Nothing will appear if''is entered. Accepts allowed variables (See). Bool true shows the default message. The default is true.
BouncerBouncer instance.
$bouncer = new Bouncer(array(
'field' => 'Hello World!'
));
$bouncer
->name('field')
->notoneof(
'Hello Guys!,Hello Friends!,Hello World!',
'The field cannot be one of those (%argument1%).'
)->validate();email( boolean $checkDNS = true, boolean|string $message = true )Field must be a valid email address.
$checkDNS(boolean) If true, it verifies that it is a valid domain name with DNS records. The default is true.$message(boolean|string) (Optional) The error message that will appear. Nothing will appear if''is entered. Accepts allowed variables (See). Bool true shows the default message. The default is true.
BouncerBouncer instance.
$bouncer = new Bouncer(array(
'field' => 'john@example.tld'
));
$bouncer
->name('field')
->email(false, 'Please enter a valid email address.')
->validate();$bouncer = new Bouncer(array(
'field' => 'john@example.tld'
));
$bouncer
->name('field')
->email(true, 'Please enter a valid email address.')
->validate();ip( boolean|string $message = true )Field must be valid IP address.
$message(boolean|string) (Optional) The error message that will appear. Nothing will appear if''is entered. Accepts allowed variables (See). Bool true shows the default message. The default is true.
BouncerBouncer instance.
$bouncer = new Bouncer(array(
'field' => '120.58.101-449'
));
$bouncer
->name('field')
->ip('[%value%] is not a valid IP address!')
->validate();url( boolean|string $message = true )Field must be valid internet address.
$message(boolean|string) (Optional) The error message that will appear. Nothing will appear if''is entered. Accepts allowed variables (See). Bool true shows the default message. The default is true.
BouncerBouncer instance.
$bouncer = new Bouncer(array(
'field' => 'example.tld'
));
$bouncer
->name('field')
->url('[%value%] is not a valid URL!')
->validate();color( boolean|string $message = true )Field must be valid hexadecimal color code.
$message(boolean|string) (Optional) The error message that will appear. Nothing will appear if''is entered. Accepts allowed variables (See). Bool true shows the default message. The default is true.
BouncerBouncer instance.
$bouncer = new Bouncer(array(
'field' => '#ff0000'
));
$bouncer
->name('field')
->url('[%value%] is not a valid color code!')
->validate();ccnum( boolean|string $message = true )Field must be a valid credit card number format.
$message(boolean|string) (Optional) The error message that will appear. Nothing will appear if''is entered. Accepts allowed variables (See). Bool true shows the default message. The default is true.
BouncerBouncer instance.
$bouncer = new Bouncer();
$bouncer
->name('field')
->value('12345678912345')
->ccnum('[%value%] is not a valid credit card number!')
->validate();ccnum( boolean|string $message = true )Field must be a valid Turkish Republic identification number.
$message(boolean|string) (Optional) The error message that will appear. Nothing will appear if''is entered. Accepts allowed variables (See). Bool true shows the default message. The default is true.
BouncerBouncer instance.
$bouncer = new Bouncer();
$bouncer
->name('field')
->value('1216608554128')
->label('T.C. identification number')
->tcnum('[%label%] field is not a valid!')
->validate();callback( callable $callback, mixed $params = array(), boolean|string $message = true )Add custom callable validation functionality.
$callback(callable) The function itself or the name of the function you want to be called.
If you want to call a method, pass it as a array. Example:
array('class', 'method');
$params(mixed) (Optional) The parameter array to be passed.$message(boolean|string) (Optional) The error message that will appear. Nothing will appear if''is entered. Accepts allowed variables (See). Bool true shows the default message. The default is true.
BouncerBouncer instance.
$bouncer = new Bouncer(array(
'field' => '76e4'
));
$bouncer
->name('field')
->callback('is_numeric', null, 'Field is not numeric.')
->validate();$bouncer = new Bouncer(array(
'pass' => '12345',
'repass' => '01234'
));
$bouncer
->name('repass')
->callback(function( $repass, $pass ) {
return ( $repass === $pass );
}, array($bouncer->get('value', 'pass')), 'Passwords do not match!')
->validate();$bouncer = new Bouncer(array(
'field' => 'Hello Guys!'
));
$bouncer
->name('field')
->callback(function( $value, $arg1 ){
return ( $arg1 == 'Hello' && false !== strpos($value, 'World') );
}, array('Hello'), 'Since %value% contains the word "Hello", you should also use the word "World" at least once!')
->validate();$bouncer = new Bouncer(array(
'product' => 'null',
'quantity' => '3'
));
$bouncer
->name('piece')
->required()
->integer()
->max(5)
->min(1)
->callback(
function( $value, $isProductValid ){
return ( $isProductValid === 1 );
},
array( $bouncer->get('valid', 'product') ),
'Please select a valid product before choosing quantity.'
)
->validate();filter( callable $callback )Filter before validating a field's value.
$callback(callable) The function itself or the name of the function you want to be called.$message(boolean|string) (Optional) The error message that will appear. Nothing will appear if''is entered. Accepts allowed variables (See). Bool true shows the default message. The default is true.
BouncerBouncer instance.
$bouncer = new Bouncer(array(
'field' => '10'
));
$bouncer
->name('field')
->filter('intval')
->integer()
->validate();$bouncer = new Bouncer(array(
'field' => ' John Doe '
));
$bouncer
->name('field')
->filter(function( $value ){
return trim( $value );
})
->validate();Bouncer contains two different data: body data including all field data and data of only a specific field.
fieldset- Get fields of the whole body,errors- Get error messages of the whole body ,valid- Get validity of the whole body. (see)
| Status | Description |
|---|---|
| 1 | all fields are valid |
| 0 | at least one field is invalid |
| -1 | at least one field is not validated |
$bouncer->get();$bouncer->get('errors');$bouncer->get()['messages'];$bouncer->get('valid');value- Get value of field,errors- Get error messages of the field,valid- Get validity of the field, (see)messages- Predefined error messages of the field,rules- Predefined rules of the field,functions- Predefined functions of the field,arguments- Predefined arguments of the field.
| Status | Description |
|---|---|
| 1 | the field is valid |
| 0 | the field is invalid |
| -1 | field not yet validated |
$bouncer->get('', 'fieldname');$bouncer->get('valid', 'fieldname');$bouncer->get('rules', 'fieldname');Bouncer can filter a number of variables so you can use them in error messages.
%value%- Outputs the value of the field.%label%- Outputs the label of the field if preset, otherwise the name of the field.%argument1%- Outputs the first parameter of the related rule.%argument2%- Outputs the second parameter of the related rule.
$bouncer
->name('piece')
->integer('%value% is not a integer.')
->validate();$bouncer
->name('piece')
->min(100, 'Error: This field can be a minimum of %argument1%.')
->validate();