Class fusionary\craftcms\bootstrap\Bootstrap
| Inheritance | fusionary\craftcms\bootstrap\Bootstrap |
|---|
Craft CMS bootstrap
Use this class in your entry script (index.php) to bootstrap your app.
Protected Properties
| Property | Type | Description | Defined By |
|---|---|---|---|
| $appTypes | array | Valid application type. | fusionary\craftcms\bootstrap\Bootstrap |
| $depth | integer | Depth of running script from project root. | fusionary\craftcms\bootstrap\Bootstrap |
| $instance | fusionary\craftcms\bootstrap\Bootstrap | Singleton instance. | fusionary\craftcms\bootstrap\Bootstrap |
Public Methods
| Method | Description | Defined By |
|---|---|---|
| define() | Gracefully define a PHP constant. | fusionary\craftcms\bootstrap\Bootstrap |
| getApp() | Get the bootstrapped app. | fusionary\craftcms\bootstrap\Bootstrap |
| loadDotEnv() | Apply environment variables from a .env file and defines CRAFT_ENVIRONMENT constant. |
fusionary\craftcms\bootstrap\Bootstrap |
| run() | Run the app. | fusionary\craftcms\bootstrap\Bootstrap |
| setDepth() | Set depth from project root | fusionary\craftcms\bootstrap\Bootstrap |
| setSite() | Define the CRAFT_SITE constant |
fusionary\craftcms\bootstrap\Bootstrap |
Protected Methods
| Method | Description | Defined By |
|---|---|---|
| getInstance() | Get instance statically. | fusionary\craftcms\bootstrap\Bootstrap |
Constants
| Constant | Value | Description | Defined By |
|---|---|---|---|
| APP_TYPE_CONSOLE | 'console' | fusionary\craftcms\bootstrap\Bootstrap | |
| APP_TYPE_WEB | 'web' | fusionary\craftcms\bootstrap\Bootstrap |
Property Details
Valid application type.
See also http://www.yiiframework.com/doc-2.0/guide-structure-applications.html#applications.
Depth of running script from project root.
Singleton instance.
Method Details
Gracefully define a PHP constant.
| public static fusionary\craftcms\bootstrap\Bootstrap define ( \fusionary\craftcms\bootstrap\string $name, $value ) | ||
| $name | string | |
| $value | mixed | |
Get the bootstrapped app.
| public static \yii\base\Application getApp ( \fusionary\craftcms\bootstrap\string $type ) | ||
| $type | string | One of $appTypes. |
Get instance statically.
| protected static fusionary\craftcms\bootstrap\Bootstrap getInstance ( ) |
Apply environment variables from a .env file and defines CRAFT_ENVIRONMENT constant.
Fails silently if:
- .env file is not found (e.g. in production).
CRAFT_ENVIRONMENTis already defined.
| public static fusionary\craftcms\bootstrap\Bootstrap loadDotEnv ( \fusionary\craftcms\bootstrap\string $path, \fusionary\craftcms\bootstrap\string $fileName = '.env', $logExceptions = false ) | ||
| $path | string | Path to directory containing env file |
| $fileName | string | Filename of env file |
| $logExceptions | boolean | Log exceptions with error_log |
Run the app.
| public integer run ( \fusionary\craftcms\bootstrap\string $type = self::APP_TYPE_WEB ) | ||
| $type | string | One of $appTypes, deaults to 'web'. |
| return | integer | The exit status |
|---|---|---|
Set depth from project root
| public static fusionary\craftcms\bootstrap\Bootstrap setDepth ( \fusionary\craftcms\bootstrap\int $depth ) | ||
| $depth | integer | |
Define the CRAFT_SITE constant
| public static fusionary\craftcms\bootstrap\Bootstrap setSite ( \fusionary\craftcms\bootstrap\string $handle ) | ||
| $handle | string | Site handle |