Skip to content
This repository was archived by the owner on Oct 8, 2024. It is now read-only.

Commit c74368b

Browse files
committed
add app config
1 parent 5b84ece commit c74368b

2 files changed

Lines changed: 44 additions & 0 deletions

File tree

Config/App.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
namespace Config;
3+
4+
/**
5+
* Leaf API App Config
6+
*/
7+
class App {
8+
/**
9+
* General Leaf API config
10+
*/
11+
protected $config = [
12+
'error.debug' => true
13+
];
14+
15+
public function __construct($config = [])
16+
{
17+
if (count($config) > 0) $this->config = $config;
18+
$this->error_debug($this->config['error.debug']);
19+
}
20+
21+
/**
22+
* Set Debug Mode (Internal)
23+
*/
24+
public static function error_debug(bool $debug = true)
25+
{
26+
if ($debug == true) {
27+
error_reporting(E_ALL);
28+
ini_set('display_errors', 1);
29+
} else {
30+
error_reporting(0);
31+
ini_set('display_errors', 0);
32+
}
33+
}
34+
35+
/**
36+
* App Config
37+
*/
38+
public static function configure(array $config)
39+
{
40+
self::$config = $config;
41+
}
42+
}

index.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
*/
4444
$app->response->cors();
4545

46+
Config\App::error_debug(false);
47+
4648
/*
4749
|--------------------------------------------------------------------------
4850
| Initialise Shortcut Functions

0 commit comments

Comments
 (0)