This commit is contained in:
2025-04-25 20:46:09 -04:00
parent 9bdecb1455
commit e84c7cf9ad
11 changed files with 2056 additions and 55 deletions

View File

@@ -5,6 +5,9 @@ declare(strict_types=1);
namespace Siteworxpro\App\Facades;
use Illuminate\Support\Facades\Facade;
use Siteworx\Config\Exception\EmptyDirectoryException;
use Siteworx\Config\Exception\FileNotFoundException;
use Siteworx\Config\Exception\UnsupportedFormatException;
/**
* Class Config
@@ -12,24 +15,20 @@ use Illuminate\Support\Facades\Facade;
* This class serves as a facade for the configuration settings of the application.
* It extends the Facade class from the Illuminate\Support\Facades namespace.
*
* @method static string|int|bool|float get(string $key, string $castTo = 'string') Retrieve the configuration value for the given key.
* @method static string|int|bool|float get(string $key) Retrieve the configuration value for the given key.
*
* @package Siteworx\App\Facades
*/
class Config extends Facade
{
public const string HTTP_PORT = 'HTTP_PORT';
public const string LOG_LEVEL = 'LOG_LEVEL';
public const string DB_DRIVER = 'DB_DRIVER';
public const string DB_HOST = 'DB_HOST';
public const string DB_DATABASE = 'DB_DATABASE';
public const string DB_USER = 'DB_USER';
public const string DB_PASSWORD = 'DB_PASSWORD';
public const string DEV_MODE = 'DEV_MODE';
public static function getFacadeRoot(): \Siteworxpro\App\Helpers\Config
/**
* @throws UnsupportedFormatException
* @throws FileNotFoundException
* @throws EmptyDirectoryException
*/
public static function getFacadeRoot(): \Siteworx\Config\Config
{
return new \Siteworxpro\App\Helpers\Config();
return \Siteworx\Config\Config::load(__DIR__ . '/../../config.php');
}
/**
@@ -39,6 +38,6 @@ class Config extends Facade
*/
protected static function getFacadeAccessor(): string
{
return \Siteworxpro\App\Helpers\Config::class;
return 'config';
}
}