PHP code example of flavacaster / symfony-http-bundle
1. Go to this page and download the library: Download flavacaster/symfony-http-bundle 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/ */
flavacaster / symfony-http-bundle example snippets
use Flavacaster\SymfonyHttpBundle\Interfaces\RequestPayloadInterface;
final class CreateUserRequest implements RequestPayloadInterface
{
/**
* @Constraints\NotBlank
* @Constraints\Type(type="string")
*/
private string $username;
/**
* @Constraints\NotBlank
* @Constraints\Type(type="integer")
*/
private int $age;
/**
* @Constraints\NotBlank
* @Constraints\Type(type="bool")
*/
private bool $terms;
}
/**
* @Route("/api/endpoint")
*/
public function create(CreateUserRequest $request): Response
{
dd($request);
}
final class Request implements RequestPayloadInterface
{
/**
* @Constraints\NotBlank
*
* @Serializer\Type("array")
* @var float[]
*/
private array $amounts;
}
use Flavacaster\SymfonyValidatorsBundle\Options\AllowExtraFields;
use Flavacaster\SymfonyValidatorsBundle\Options\AllowMissingFields;
/**
* @AllowExtraFields
* @AllowMissingFields
*/
final class Request implements RequestPayloadInterface
{
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.