PHP code example of abc / api-problem

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

    

abc / api-problem example snippets


use Abc\ApiProblem;

$apiProblem = new ApiProblem(
    'http://domain.tld/problem/resource-not-found'),
    'Resource Not Found',
    404,
    sprintf('Resource with id "%s" not found', $id),
    $requestUri
);

$json = $apiProblem->toJson();