PHP code example of revenkroz / validating-param-converter

1. Go to this page and download the library: Download revenkroz/validating-param-converter library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

revenkroz / validating-param-converter example snippets


use Revenkroz\ValidatingParamConverter\Request\ValidatableParamInterface;

class YourDto implements ValidatableParamInterface
{
    public static function getRequestConstraint(): Constraint
    {
        // ...
    }
}

public function customAction(YourDto $dto, Request $request): Response {}

use Revenkroz\ValidatingParamConverter\Request\CustomGroupsValidatableParamInterface;

class YourDto implements CustomGroupsValidatableParamInterface
{
    public static function getRequestConstraint(): Constraint
    {
        // ...
    }

    public static function getRequestValidationGroups(): array
    {
        return ['one_group', 'another_group'];
    }
}
yaml
Revenkroz\ValidatingParamConverter\Request\ParamConverter\ValidatingParamConverter:
    class: Revenkroz\ValidatingParamConverter\Request\ParamConverter\ValidatingParamConverter
    tags:
        - { name: 'request.param_converter', priority: false }