ApplicationContext

The TYPO3 Context object.

A TYPO3 Application context is something like "Production", "Development", "Production/StagingSystem", and is set using the TYPO3_CONTEXT environment variable.

A context can contain arbitrary sub-contexts, which are delimited with slash ("Production/StagingSystem", "Production/Staging/Server1"). The top-level contexts, however, must be one of "Testing", "Development" and "Production".

Mainly, you will use $context->isProduction(), $context->isTesting() and $context->isDevelopment() inside your custom code.

ATTENTION: The Testing context is only used internally when executing TYPO3 Core tests. It must not be used otherwise.

This class is derived from the TYPO3 Flow framework. Credits go to the respective authors.

Table of Contents

Properties

$contextString  : string
The (internal) context string; could be something like "Development" or "Development/MyLocalMacBook"
$parentContext  : ApplicationContext|null
The parent context, or NULL if there is no parent context
$rootContextString  : string
The root context; must be one of "Development", "Testing" or "Production"

Methods

__construct()  : mixed
Initialize the context object.
__toString()  : string
Returns the full context string, for example "Development", or "Production/LiveSystem"
getParent()  : ApplicationContext|null
Returns the parent context object, if any
isDevelopment()  : bool
Returns TRUE if this context is the Development context or a sub-context of it
isProduction()  : bool
Returns TRUE if this context is the Production context or a sub-context of it
isTesting()  : bool
Returns TRUE if this context is the Testing context or a sub-context of it

Properties

$contextString

The (internal) context string; could be something like "Development" or "Development/MyLocalMacBook"

protected string $contextString

$rootContextString

The root context; must be one of "Development", "Testing" or "Production"

protected string $rootContextString

Methods

__construct()

Initialize the context object.

public __construct(string $contextString) : mixed
Parameters
$contextString : string
Tags
throws
Exception

if the parent context is none of "Development", "Production" or "Testing"

__toString()

Returns the full context string, for example "Development", or "Production/LiveSystem"

public __toString() : string
Return values
string

isDevelopment()

Returns TRUE if this context is the Development context or a sub-context of it

public isDevelopment() : bool
Return values
bool

isProduction()

Returns TRUE if this context is the Production context or a sub-context of it

public isProduction() : bool
Return values
bool

isTesting()

Returns TRUE if this context is the Testing context or a sub-context of it

public isTesting() : bool
Return values
bool

        
On this page

Search results