Download the PHP package roy404/request without Composer
On this page you can find all versions of the php package roy404/request. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package request
REQUEST CLASS
Install the bundle using Composer:
DOCUMENTATION
This PHP class is designed to handle HTTP requests and provide validation and error handling functionalities. It extends the Blueprints
class and provides methods for validating inputs, accessing request data, and checking for errors.
Usage
-
Instantiate the class: Create an instance of the
Request
class to access its methods. -
Validate inputs: Use the validate() method to specify validation rules and the isSuccess() and isFailed() methods to check if validation was successful.
- Set custom error messages: Use the message() method before the isSuccess() and isFailed() to set custom error messages for validation rules.
Available Methods
inputs(): array
: Get all input values.input(string $name): mixed
: Get the value of a specific input.has(string $key): bool
: Check if an input exists.method(): string
: Get the HTTP request method.only(array $input_keys): array
: Get only the specified input values.except(array $input_keys): array
: Get all input values except the specified keys.errors(bool $force_all = false): array
: Get validation errors.error(string $key): mixed
: Get the error message for a specific input key.isMatched(string $key, mixed $value): bool
: Check if the input value matches the specified value.isSuccess(): bool
: Check if validation was successful.isFailed(): bool
: Check if validation failed.validate(array $array): self
: Set validation rules.message(array $array): void
: Set custom error messages.
Validation Rules
image
: Ensures that the input is a valid image file, such as JPEG, PNG, GIF, SVG, or WEBP.file
: Validates that the input is a valid file upload.required
: Checks that the input is not empty.array
: Verifies that the input is an array.null
: Checks that the input is null.numeric
: Ensures that the input is a numeric value.integer
: Checks that the input is an integer.string
: Verifies that the input is a string.email
: Validates that the input is a valid email address.password
: Validates that the input is a valid password.confirmed
: Checks that the input value matches another field (typically used for password confirmation).mimes
: Specifies the allowed MIME types for file uploads, such as JPEG, PNG, PDF, etc.extensions
: Specifies the allowed file extensions for file uploads, such as pdf, xlsx, etc.max
: Specifies the maximum file size in MB allowed for file uploads or the maximum characters length for strings.min
: Specifies the minimum characters length for strings.dimensions
: Validates the dimensions (width and height) of an image file, enforcing minimum or maximum width and height requirements for images. It supports options likemax_width
,max_height
,min_width
,min_height
,width
, andheight
.
All versions of request with dependencies
PHP Build Version
Package Version
Requires
php Version
^8.0
The package roy404/request contains the following files
Loading the files please wait ....