<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
youniverse-center / request-validation-bundle example snippets
#[Route('/some/route', name: 'some_route')]
#[RequestValidator(Create::class)]
class CreateController extends AbstractController
{
public function __invoke($data)
{
// in the data is your validated request content
}
}
public function getData(Request $request): mixed
{
return json_decode($request->getContent(), true);
}
public function transformData(mixed $data): array
{
$id = ProjectId::fromString($data['id']);
return [
'project' => new Project($id, $data['name'])
];
}
public function __invoke(Project $project) {}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.