PHP code example of fusonic / api-documentation-bundle
1. Go to this page and download the library: Download fusonic/api-documentation-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/ */
fusonic / api-documentation-bundle example snippets
#[DocumentedRoute(path: '/test-return-type/{id}', methods: ['GET'])]
public function testReturnType(#[FromRequest] TestRequest $query): TestResponse
{
return new TestResponse($query->id);
}
#[DocumentedRoute(path: '/test-return-type/{id}', methods: ['GET'], input: TestRequest::class, output: TestResponse::class)]
public function testReturnType(int $id): JsonResponse
{
return new JsonResponse(['id' => $query->id], 200);
}