<?php

if (!function_exists('base_url')) {
    function base_url(string $path = ''): string
    {
        $appUrl = rtrim($_ENV['APP_URL'] ?? '', '/');
        $path = '/' . ltrim($path, '/');

        return $appUrl . $path;
    }
}

if (!function_exists('redirect')) {
    function redirect(string $path): void
    {
        header('Location: ' . base_url($path));
        exit;
    }
}