PHP Classes

File: resources/Views/system_errors/api.php

Recommend this page to a friend!
  Classes of Ujah Chigozie peter   Luminova REST API Example   resources/Views/system_errors/api.php   Download  
File: resources/Views/system_errors/api.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Luminova REST API Example
Implements an example of a REST API
Author: By
Last change:
Date: 17 days ago
Size: 847 bytes
 

Contents

Class file image Download
<?php
/**
 * Luminova Framework
 *
 * @package Luminova
 * @author Ujah Chigozie Peter
 * @copyright (c) Nanoblock Technology Ltd
 * @license See LICENSE file
 */
$error = [
   
'code' => $stack ? $stack->getCode() : 0,
   
'title' => $stack ? htmlspecialchars($stack->getName()) : null,
];

if (
defined('PRODUCTION') && !PRODUCTION) {
   
$error['message'] = $stack ? htmlspecialchars($stack->getMessage()) : null;
}else{
   
$error['message'] = 'Something went wrong, please check your server error logs for more details.';
}

response(500)->json([
   
'error' => $error,
   
'framework' => [
       
'php_version' => PHP_VERSION,
       
'version' => defined('\Luminova\Application\Foundation::VERSION') ? \Luminova\Application\Foundation::VERSION : '1.0.0',
       
'environment' => defined('ENVIRONMENT') ? ENVIRONMENT : 'Unknown',
    ]
]);