Skip to content

Commit

Permalink
add error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ReactMVC authored Aug 3, 2023
1 parent 8603327 commit 9bf16de
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
APP_NAME="API-Monster"
APP_NAME="API-Monster"
APP_DEBUG=true
7 changes: 5 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,8 @@
"homepage": "https://t.me/h3dev",
"role": "Developer"
}
]
}
],
"require": {
"filp/whoops": "^2.15"
}
}
10 changes: 10 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
use Monster\App\Models\Env;
use Monster\App\Route;

/*
Expand Down Expand Up @@ -66,6 +67,15 @@
// Autoload dependencies using Composer
require_once 'vendor/autoload.php';

// PHP error handling
$config = new Env('.env');
$debug = $config->get("APP_DEBUG");
if ($debug == "true") {
$whoops = new \Whoops\Run;
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
$whoops->register();
}

// Load application routes
require 'routes/web.php';

Expand Down

0 comments on commit 9bf16de

Please sign in to comment.