Switcher
in package
implements
EnvSwitcherInterface
Class EnvSwitch.
This class implements the EnvSwitcherInterface and provides methods for setting up different environmental configurations such as development, staging, production, and debugging within your application.
Tags
Interfaces, Classes, Traits and Enums
- EnvSwitcherInterface
- Interface for managing different environment settings.
Table of Contents
- $constants : mixed
- $error_logs_dir : string
- Sets the Error logs directory relative path.
- $constantBuilder : ConstantBuilder
- __construct() : mixed
- createEnvironment() : void
- Switches between different environments based on the value of $environment.
- debug() : void
- Debug.
- development() : void
- Configure the environment for development.
- production() : void
- Configure the environment for production.
- secure() : void
- Secure.
- staging() : void
- Configure the environment for staging.
- setDebugLog() : void
- Set debug environment.
- setCache() : void
- setErrorLogsDir() : void
- Set error_logs_dir for environment.
Properties
$constants
protected
mixed
$constants
$error_logs_dir
Sets the Error logs directory relative path.
protected
string
$error_logs_dir
$constantBuilder
private
ConstantBuilder
$constantBuilder
Methods
__construct()
public
__construct(ConstantBuilder $constantBuilder) : mixed
Parameters
- $constantBuilder : ConstantBuilder
Return values
mixed —createEnvironment()
Switches between different environments based on the value of $environment.
public
createEnvironment(string $environment, string|null $error_logs_dir) : void
Parameters
- $environment : string
-
The environment to switch to.
- $error_logs_dir : string|null
-
The error logs directory relative path.
Return values
void —debug()
Debug.
public
debug() : void
Return values
void —development()
Configure the environment for development.
public
development() : void
This method should be used in a development environment.
Return values
void —production()
Configure the environment for production.
public
production() : void
This method should be used in a production environment.
Return values
void —secure()
Secure.
public
secure() : void
Return values
void —staging()
Configure the environment for staging.
public
staging() : void
This method should be used in a staging environment.
Return values
void —setDebugLog()
Set debug environment.
protected
setDebugLog() : void
Return values
void —setCache()
private
setCache() : void
Return values
void —setErrorLogsDir()
Set error_logs_dir for environment.
private
setErrorLogsDir(string|null $error_logs_dir) : void
Parameters
- $error_logs_dir : string|null