PHP code example of dmp / rest-bundle

1. Go to this page and download the library: Download dmp/rest-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/ */

    

dmp / rest-bundle example snippets


use DMP\RestBundle\Annotation as Rest;
use Symfony\Component\HttpKernel\Attribute\MapRequestPayload;
use Symfony\Component\Routing\Attribute\Route;

class TestController
{

    #[Route("/api/test", methods: ["POST"])]
    #[Rest\Serializable(statusCode: 201)]
    public function request(#[MapRequestPayload] RequestDTO $request): ResponseDTO
    {
        ...
    }
}