1. Go to this page and download the library: Download asylum29/api-skeleton 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/ */
asylum29 / api-skeleton example snippets
// унаследуйте контроллер от BaseController
class CustomController extends BaseController
{
/**
* @Route("/custom", name="app_custom")
*/
public function index(): Response
{
...
return $this->success($dataOrEntity);
}
}
// в Entity или DTO
/** @Groups("groupName") */
private $field;
/** @Groups("groupName") */
public function getField(): fieldtype
// в контроллере
return $this->success($dataOrEntity, ['groups' => 'groupName']);