Environment
class Environment (View source)
Consolidates access and modification of PHP global variables and settings.
This class should be used sparingly, and only if information cannot be obtained from a current HTTPRequest object.
Acts as the primary store for environment variables, including those loaded
from .env files. Applications should use Environment::getEnv() instead of php's
getenv in order to include .env configuration, as the system's actual
environment variables are treated immutably.
Properties
| protected static | float|null | $memoryLimitMax | Set maximum limit allowed for increaseMemoryLimit  | 
                |
| protected static | int|null | $timeLimitMax | Set maximum limited allowed for increaseTimeLimit  | 
                |
| protected static | array | $env | Local overrides for all $_ENV var protected from cross-process operations  | 
                
Methods
Increase the memory limit to the given level if it's currently too low.
Set the maximum allowed value for increaseMemoryLimitTo().
Increase the time limit of this script. By default, the time will be unlimited.
Set the maximum allowed value for increaseTimeLimitTo();
Returns true if this script is being run from the command line rather than the web server
Details
        
                static            array
    getVariables()
        
    
    Extract env vars prior to modification
        
                static            
    setVariables(array $vars)
        
    
    Restore a backed up or modified list of vars to $globals
        
                static            bool
    increaseMemoryLimitTo(string|float|int $memoryLimit = -1)
        
    
    Increase the memory limit to the given level if it's currently too low.
Only increases up to the maximum defined in setMemoryLimitMax(), and defaults to the 'memory_limit' setting in the PHP configuration.
        
                static            
    setMemoryLimitMax(string|float $memoryLimit)
        
    
    Set the maximum allowed value for increaseMemoryLimitTo().
The same result can also be achieved through 'suhosin.memory_limit' if PHP is running with the Suhosin system.
        
                static            int
    getMemoryLimitMax()
        
    
    No description
        
                static            bool
    increaseTimeLimitTo(int $timeLimit = null)
        
    
    Increase the time limit of this script. By default, the time will be unlimited.
Only works if 'safe_mode' is off in the PHP configuration. Only values up to getTimeLimitMax() are allowed.
        
                static            
    setTimeLimitMax(int $timeLimit)
        
    
    Set the maximum allowed value for increaseTimeLimitTo();
        
                static            int
    getTimeLimitMax()
        
    
    No description
        
                static            mixed
    getEnv(string $name)
        
    
    Get value of environment variable.
If the value is false, you should check Environment::hasEnv() to see if the value is an actual environment variable value or if the variable simply hasn't been set.
        
                static            
    putEnv(string $string)
        
    
    Set environment variable using php.ini syntax.
Acts as a process-isolated version of putenv() Note: This will be parsed via parse_ini_string() which handles quoted values
        
                static            
    setEnv(string $name, string $value)
        
    
    Set environment variable via $name / $value pair
        
                static            bool
    hasEnv(string $name)
        
    
    Check if an environment variable is set
        
                static            bool
    isCli()
        
    
    Returns true if this script is being run from the command line rather than the web server