PHP code example of diegograssato / sf-api-problem
1. Go to this page and download the library: Download diegograssato/sf-api-problem 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/ */
diegograssato / sf-api-problem example snippets
use DTUX\ApiProblem\ApiProblem;
use DTUX\ApiProblem\ApiProblemResponse;
class FakeController
{
public function fetch($id)
{
$entity = $this->service->fetch($id);
if (!$entity) {
return new ApiProblemResponse(new ApiProblem(404, 'Entity not found'));
}
return $entity;
}
}