Download the PHP package phpdevcommunity/php-requestkit without Composer

On this page you can find all versions of the php package phpdevcommunity/php-requestkit. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-requestkit

php-requestkit

Lightweight and efficient PHP library for robust request data validation and transformation.

Simplify your request processing with php-requestkit. This library allows you to define schemas for your incoming HTTP requests (both form submissions and JSON payloads) and effortlessly validate and transform the data. Ensure data integrity and streamline your application logic with schema-based validation, input sanitization, and flexible transformation methods.

Key Features

Installation

Basic Usage

  1. Create a Schema: Define your data structure and validation rules using Schema::create() and Type classes.

  2. Process Request Data: Use the process() method of your schema to validate and transform incoming data.

Usage Examples

Validating REST API Request Body (JSON or Form Data)

This example demonstrates validating data from a REST API endpoint (e.g., POST, PUT, PATCH requests).

Validating URL Parameters (Query String)

Validate parameters passed in the URL's query string.

Validating Collections of Data (Arrays)

Validate arrays of data, especially useful for batch operations or list endpoints.

Error Handling with InvalidDataException

When validation fails, the Schema::process() method throws an InvalidDataException. This exception provides methods to access detailed error information.

Retrieving All Errors

Use getErrors() to get an associative array where keys are field paths and values are error messages.

Retrieving a Specific Error

Use getError(string $key) to get the error message for a specific field path. Returns null if no error exists for that path.

Formatting Error Response with toResponse()

Use toResponse() to get a pre-formatted associative array suitable for returning as an API error response. This includes status, a general error message, and detailed validation errors.

Accessing Exception message and code

InvalidDataException extends PHP's base \Exception, allowing access to standard exception properties.

Available Validation Types and Rules

php-requestkit provides a variety of built-in data types with a rich set of validation rules.

Extending Schemas

You can extend existing schemas to reuse and build upon validation logic.


All versions of php-requestkit with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
ext-json Version *
phpdevcommunity/php-validator Version ^1.0
psr/http-message Version ^1.0 || ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package phpdevcommunity/php-requestkit contains the following files

Loading the files please wait ....