Interface for managing configuration settings in the application. This interface provides methods to retrieve essential configuration values such as root directory paths, debug modes, and folders used during the build process.
To simplify its implementation, you can use the provided ConfigHelperTrait
.
Example usage:
use Darken\Config\ConfigHelperTrait;
public function __construct(private readonly string $rootDirectoryPath)
{
$this->loadEnvFile();
}
getRootDirectoryPath() |
---|
getDebugMode() |
getBuildOutputFolder() |
getBuildOutputNamespace() |
getBuildingFolders() |
Get the root directory path of the application. This path serves as the base for resolving other directories and configuration values.
Example:
return $this->path($this->rootDirectoryPath);
Return | string |
Determine if the application is in debug mode.
The debug mode can be enabled or disabled via the DARKEN_DEBUG
environment variable.
Example:
return (bool) $this->env('DARKEN_DEBUG', false);
Return | bool |
Get the output folder path for build artifacts.
The folder is resolved relative to the root directory and can be customized
using the DARKEN_BUILD_OUTPUT_FOLDER
environment variable.
Example:
return $this->getRootDirectoryPath() . DIRECTORY_SEPARATOR . $this->env('DARKEN_BUILD_OUTPUT_FOLDER', '.build');
Return | string |
Get the namespace used for build output.
The namespace can be customized using the DARKEN_BUILD_OUTPUT_NAMESPACE
environment variable.
Example:
return $this->env('DARKEN_BUILD_OUTPUT_NAMESPACE', 'Build');
Return | string |
Get a list of folders involved in the building process. This typically includes the components folder and the pages folder.
Example:
return [
$this->getRootDirectoryPath() . DIRECTORY_SEPARATOR . 'components',
$this->getPagesFolder(),
];
Return | array |