Download the PHP package rnd-cosoft/api-tools-content-validation without Composer

On this page you can find all versions of the php package rnd-cosoft/api-tools-content-validation. 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 api-tools-content-validation

Laminas Content Validation

Build Status

🇷🇺 Русским гражданам

Мы, участники Laminas, родились и живем в разных странах. У многих из нас есть друзья, родственники и коллеги как в России, так и в Украине. Некоторые из нас родились в России. Некоторые из нас живут в России. У некоторых бабушки и дедушки сражались с фашистами во Второй мировой войне. Здесь никто не поддерживает фашизм.

У одного из нас есть украинская родственница, которая спаслась из дома вместе с сыном. Поезд задержался из-за бомбежки на дороге впереди. У нас есть друзья, которые прячутся в бомбоубежищах. Мы с тревогой ждем весточки от них после воздушных налетов, которые беспорядочно наносят удары и попадают по больницам, школам, детским садам и домам. Мы не берем это из каких-либо СМИ. Мы наблюдаем это напрямую.

Вы доверяете нам достаточно, чтоб использовать наши программы, и мы просим вас довериться нам вновь. Мы нуждаемся в помощи. Выходите и протестуйте против этой бесполезной войны. Остановите кровопролитие. Скажите "Нет войне!"

🇺🇸 To Citizens of Russia

We at Laminas come from all over the world. Many of us have friends, family and colleagues in both Russia and Ukraine. Some of us were born in Russia. Some of us currently live in Russia. Some have grandparents who fought Nazis in World War II. Nobody here supports fascism.

One team member has a Ukrainian relative who fled her home with her son. The train was delayed due to bombing on the road ahead. We have friends who are hiding in bomb shelters. We anxiously follow up on them after the air raids, which indiscriminately fire at hospitals, schools, kindergartens and houses. We're not taking this from any media. These are our actual experiences.

You trust us enough to use our software. We ask that you trust us to say the truth on this. We need your help. Go out and protest this unnecessary war. Stop the bloodshed. Say "stop the war!"

Introduction

Laminas module for automating validation of incoming input.

Allows the following:

Requirements

Please see the composer.json file.

Installation

Run the following composer command:

Alternately, manually add the following to your composer.json, in the require section:

And then run composer update to ensure the module is installed.

Finally, add the module name to your project's config/application.config.php under the modules key:

Configuration

User Configuration

This module utilizes two user level configuration keys api-tools-content-validation and also input_filter_specs (named such that this functionality can be moved into Laminas in the future).

Service Name key

The api-tools-content-validation key is a mapping between controller service names as the key, and the value being an array of mappings that determine which HTTP method to respond to and what input filter to map to for the given request. The keys for the mapping can either be an HTTP method that accepts a request body (i.e., POST, PUT, PATCH, or DELETE), or it can be the word input_filter. The value assigned for the input_filter key will be used in the case that no input filter is configured for the current HTTP request method.

Example where there is a default as well as a POST filter:

In the above example, the Application\Controller\HelloWorld\Validator service will be selected for PATCH, PUT, or DELETE requests, while the Application\Controller\HelloWorld\CreationValidatorwill be selected for POST requests.

Starting in version 1.1.0, two additional keys can be defined to affect application validation behavior:

Validating GET requests

  • Since 1.3.0.

Starting in 1.3.0, you may also specify GET as an HTTP method, mapping it to an input filter in order to validate your query parameters. Configuration is exactly as described in the above section.

This feature is only available when manually configuring your API; it is not exposed in the Admin UI.

Validating collection requests

  • Since 1.5.0

Starting in 1.5.0, you may specify any of:

  • POST_COLLECTION
  • PUT_COLLECTION
  • PATCH_COLLECTION

as keys. These will then be used specifically with the given HTTP method, but only on requests matching the collection endpoint.

Validating DELETE requests

  • Since 1.6.0

Starting in 1.6.0, you may specify each of the following keys for input filters:

  • DELETE
  • DELETE_COLLECTION

The input filter associated with the key will be used to validate data sent in the request body.

input_filter_spec

input_filter_spec is for configuration-driven creation of input filters. The keys for this array will be a unique name, but more often based off the service name it is mapped to under the api-tools-content-validation key. The values will be an input filter configuration array, as is described in the Laminas manual section on input filters.

Example:

System Configuration

The following configuration is defined by the module in order to function within a Laminas application.

Laminas Events

Listeners

Laminas\ApiTools\ContentValidation\ContentValidationListener

This listener is attached to the MvcEvent::EVENT_ROUTE event at priority -650. Its purpose is to utilize the api-tools-content-validation configuration in order to determine if the current request's selected controller service name has a configured input filter. If it does, it will traverse the mappings from the configuration file to create the appropriate input filter (from configuration or the Laminas input filter plugin manager) in order to validate the incoming data. This particular listener utilizes the data from the api-tools-content-negotiation data container in order to get the deserialized content body parameters.

Events

Laminas\ApiTools\ContentValidation\ContentValidationListener::EVENT_BEFORE_VALIDATE

This event is emitted by Laminas\ApiTools\ContentValidation\ContentValidationListener::onRoute() (described above) in between aggregating data to validate and determining the input filter, and the actual validation of data. Its purpose is to allow users:

As an example, you might want to validate an identifier provided via the URI, and matched during routing. You may do this as follows:

Laminas Services

Controller Plugins

Laminas\ApiTools\ContentValidation\InputFilter\InputFilterPlugin (aka getInputFilter)

This plugin is available to Laminas controllers. When invoked ($this->getInputFilter() or $this->plugin('getinputfilter')->__invoke()), it returns whatever is in the MVC event parameter Laminas\ApiTools\ContentValidation\InputFilter, returning null for any value that is not an implementation of Laminas\InputFilter\InputFilter.

Service

Laminas\InputFilter\InputFilterAbstractServiceFactory

This abstract factory is responsible for creating and returning an appropriate input filter given a name and the configuration from the top-level key input_filter_specs. It is registered with Laminas\InputFilter\InputFilterPluginManager.


All versions of api-tools-content-validation with dependencies

PHP Build Version
Package Version
Requires php Version ~8.1.0 || ~8.2.0 || ~8.3.0
rnd-cosoft/api-tools-api-problem Version ^1.6
rnd-cosoft/api-tools-content-negotiation Version ^1.8
laminas/laminas-eventmanager Version ^3.4.0
laminas/laminas-filter Version ^2.13.0
laminas/laminas-http Version ^2.15.1
laminas/laminas-inputfilter Version ^2.13
laminas/laminas-mvc Version ^3.3.0
laminas/laminas-servicemanager Version ^3.11.1
laminas/laminas-stdlib Version ^3.6.1
laminas/laminas-validator Version ^2.15.0
laminas/laminas-zendframework-bridge Version ^1.1
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 rnd-cosoft/api-tools-content-validation contains the following files

Loading the files please wait ....