PHP code example of los / api-problem

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

    

los / api-problem example snippets


$app->pipe(new \LosMiddleware\ApiProblem\ApiProblem());

return [
    'dependencies' => [
        'invokables' => [
            LosMiddleware\ApiProblem\ApiProblem::class => LosMiddleware\ApiProblem\ApiProblem::class,
        ],
    ],
    'middleware_pipeline' => [
        'error' => [
            'middleware' => [
                LosMiddleware\ApiProblem\ApiProblem::class, 
            ]
            'error' => true,
        ],
    ],
];