Download the PHP package rsthn/rose-ext-shield without Composer
On this page you can find all versions of the php package rsthn/rose-ext-shield. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rsthn/rose-ext-shield
More information about rsthn/rose-ext-shield
Files in rsthn/rose-ext-shield
Package rose-ext-shield
Short Description Shield Validation Extension
License Apache-2.0
Informations about the package rose-ext-shield
Shield Validation Extension
Shield provides a set of functions to validate data in a very robust way.
Installation
Functions
(shield:method-required
\)
Ensures the request was made using the specified method(s) or fails with 405/@messages.method_not_allowed.
(shield:body-required
[false|true|content-type...])
Ensures the request's content-type is one of the specified types. Fails with 422/@messages.request_body_missing if there is no
request body, or with 422/@messages.invalid_content_type if the content-type is not valid. If no content type is provided then
it is assumed to be application/json
. Use value true
to allow any content type.
(shield:body-min-size
\)
Ensures the request's body is at least the specified number of bytes. Fails with 422/@messages.request_body_too_small if not.
(shield:body-max-size
\)
Ensures the request's body does not exceed the specified number of bytes. Fails with 422/@messages.request_body_too_large when so.
(shield:field
\ [rules...])
Returns a field descriptor.
(shield:type
\ \)
Registers a type validation descriptor to be used by name in the type
rules.
(shield:begin
)
Begins quiet validation mode. All validation errors will be accumulated, and should later be retrieved by calling shield:end
,
this is useful to batch multiple validation blocks at once.
(shield:end
[automatic=true])
Ends quiet validation mode, if there are any errors and automatic
is set to true
(default), then Wind::R_VALIDATION_ERROR will
be thrown, otherwise, the error map will just be returned.
(shield:validate
[output-var] \)
Validates the fields in the gateway request. Any error will be reported, and the validated object will be available in the
global context or in the output variable (if provided) when validation succeeds.
NOTE: This is a legacy function, use the replacement shield:validate-data
when possible.
(shield:model
\)
Creates and returns a new validation model to be re-used later with shield:validate-data
.
(shield:validate-data
\ \ \<model|data-descriptors...>)
Validates the fields in the input data using the specified data rules. If any validation error occurs an exception will be thrown. If the data is successfully validated it will be available in the output variable.