PHP code example of juliangut / http-exception
1. Go to this page and download the library: Download juliangut/http-exception 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/ */
juliangut / http-exception example snippets
use Jgut\HttpException\HttpException;
$exceptionMessage = 'You shall not pass!';
$exceptionDescription = 'You do not have permission';
$exceptionCode = 1001; // Internal code
$previousException = new \Exception();
$exception = new BadRequestHttpException($exceptionMessage, $exceptionDescription, $exceptionCode, $previousException);
$exception->getStatusCode(); // 400 Bad Request
$exception->getDescription();
$exception->getIdentifier();