<?php

declare(strict_types=1);

use Dotenv\Dotenv;

if (session_status() !== PHP_SESSION_ACTIVE) {
    session_start();
}

$rootPath = dirname(__DIR__);

require_once $rootPath . '/vendor/autoload.php';

if (file_exists($rootPath . '/.env')) {
    $dotenv = Dotenv::createImmutable($rootPath);
    $dotenv->safeLoad();
}

date_default_timezone_set(
    $_ENV['APP_TIMEZONE']
        ?? 'Africa/Casablanca'
);

define('BASE_PATH', $rootPath);
define('VIEW_PATH', BASE_PATH . '/resources/views');
define('STORAGE_PATH', BASE_PATH . '/storage');
