KT-personal-website/app/Utils/Config.php

28 lines
677 B
PHP
Raw Normal View History

2024-10-22 12:26:08 +02:00
<?php
namespace App\Utils;
class Config {
static $config = [
'siteName' => 'My super page',
'author' => 'Me !!!',
'useCache' => false,
'postPerPage' => 5,
'numberOfLastItem' => 5,
'debug' => false,
'fetching' => [],
'navLinks' => []
];
/**
* Loads the configuration from file
*
* @return array The configuration data
*/
static function loadConfig(): array {
if (file_exists(__DIR__ . "/../../datas/config.json")) {
self::$config = json_decode(file_get_contents(__DIR__ . '/../../datas/config.json'), true);
}
return self::$config;
}
}