skowronline/query-param-validator-bundle

Validate Query Param values

v1.0.0 2017-01-05 08:54 UTC

This package is not auto-updated.

Last update: 2024-05-29 17:37:49 UTC


README

Bundle helps you validate request query string values

Build Status codecov.io SensioLabsInsight

Installation

composer require skowronline/query-param-validator-bundle
// app/config.yml
imports:
    ...
    - { resource: '@SkowronlineQueryParamValidatorBundle/Resources/config/services.yml' }

Usage

/**
 * @QueryParam("order", allowed={"asc", "desc"}, required=true)
 */
public function indexAction()
/route -> 404 Page Not Found
/route?order=asc -> 200 Ok
/route?order=desc -> 200 Ok
/route?order=random -> 404 Page Not Found

You can use multiple annotations

/**
 * @QueryParam("order", allowed={"asc", "desc"}, required=true)
 * @QueryParam("page", required=false)
 */
public function indexAction()