AppKernel, config.yml → config/packages).validator component) or libraries like API Platform or NelmioApiDocBundle.AppKernel with config/bundles.php, and add PHP 8.x support.notEmpty, stringType) with Symfony’s validator.keySet) to custom constraint classes.composer.json to target a maintained branch (if available) or fork.AppKernel with config/bundles.php.config.yml → config/packages, AppKernel → Kernel.Respect/Validation v1.x may need updates for PHP 8.x.setData()).composer require domtomproject/easy-rest-bundle dev-master.config/bundles.php.config/packages/domtom_easy_rest.yaml.config/validation/ (or app/Resources/validation if legacy).use DomTomProject\EasyRestBundle\Validator\Validator;
// ...
$validator = $this->get('domtom_easy_rest.validator');
$errors = $validator->validate($data, 'User');
// src/EventListener/ValidationErrorListener.php
public function onKernelException(GetResponseForExceptionEvent $event) {
if ($event->getThrowable() instanceof ValidationFailedException) {
$event->setResponse(new JsonResponse($this->formatErrors($event->getThrowable()), 400));
}
}
How can I help you explore Laravel packages today?