Download the PHP package seblegall/api-validator-bundle without Composer

On this page you can find all versions of the php package seblegall/api-validator-bundle. 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-validator-bundle

Api Validator Bundle

GitHub license Build Status Code Coverage Scrutinizer Code Quality

A Symfony's parameters bag based data validation bundle.

Requirements

How it works

REST is great. But, most of the time, it is quite hard to think your WebServices architecture in a way that each WS is stateless. Here is an example.

If you have to design a personal data form and wish to ask the user to complete some fields such as the name, the firstname, the birthdate, and two addresses with, for each, an addresse, a city, a zipcode, and a country.

In that case, your database model will probably looks like that :

user user_address address
id_user id_user id_adress
name id_address address
firstname city
birthdate zipcode
country

Now, if you would like to strictly use REST standards, you will probably expose 2 WS :

However, most of the time, this is probably not what you'll do. There are some reasons why :

A common way to avoid such problems is using the Symfony Form Builder in the API. Then, you need to hydrate your form with the request data and test the Symfony validator method isValid() on the form.

This is not a good way to deal with REST data validation.

This bundle is the solution you need.

Instead of exposing 2 WS, you will only expose one. You will be able to send all your datas as a Json object and validate the Json object instead of validate each domain object apart.

Here is an example of what you will be able to do :

Send your data :

And then, the bundle validate all the object for you using the Symfony Validator Component. All you need to do is creating a ParameterBag Class in which you'll define all the expected parameters (query, post, get, etc.) and created an associated validator file where you will define all the rules you need.

You could, for example, apply some unique constraints on the addresses.

Installation

Using composer :

Then, set up the bundle in your Symfony's AppKernel.php file :

Finally, import the bundle routing by inserting those lines in the app/config/routing.yml file :

Usage

See documentation.

License

ApiValidatorBundle is licensed under the MIT License - see the LICENSE file for details


All versions of api-validator-bundle with dependencies

PHP Build Version
Package Version
Requires symfony/framework-bundle Version ~2.4|~3.0
doctrine/annotations Version ~1.1
symfony/finder Version ~2.4|~3.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 seblegall/api-validator-bundle contains the following files

Loading the files please wait ....