Class Craft
- Inheritance
- Craft » Yii » yii\BaseYii
- Available since version
- 3.0
- Source Code
- https://github.com/craftcms/cms/blob/master/src/Craft.php
Craft is helper class serving common Craft and Yii framework functionality.
It encapsulates Yii and ultimately yii\BaseYii, which provides the actual implementation.
Property | Type | Description | Defined By |
---|---|---|---|
$aliases |
array | Registered path aliases | yii\BaseYii |
$app |
craft\web\Application, craft\console\Application | The application instance. | Craft |
$classMap |
array | Class map used by the Yii autoloading mechanism. | yii\BaseYii |
$container |
yii\di\Container | The dependency injection (DI) container used by createObject(). | yii\BaseYii |
Method | Description | Defined By |
---|---|---|
autoload() |
Class autoloader. | Craft |
beginProfile() |
Marks the beginning of a code block for profiling. | yii\BaseYii |
configure() |
Configures an object with the initial property values. | yii\BaseYii |
cookieConfig() |
Generates and returns a cookie config. | Craft |
createGuzzleClient() |
Creates a Guzzle client configured with the given array merged with any default values in config/guzzle.php. | Craft |
createObject() |
Creates a new object using the given configuration. | yii\BaseYii |
dd() |
Displays a variable and ends the request. (“Dump and die”) | Craft |
debug() |
Logs a debug message. | yii\BaseYii |
dump() |
Displays a variable. | Craft |
endProfile() |
Marks the end of a code block for profiling. | yii\BaseYii |
error() |
Logs an error message. | yii\BaseYii |
getAlias() |
Translates a path alias into an actual path. | yii\BaseYii |
getLogger() |
yii\BaseYii | |
getObjectVars() |
Returns the public member variables of an object. | yii\BaseYii |
getRootAlias() |
Returns the root alias part of a given alias. | yii\BaseYii |
getVersion() |
Returns a string representing the current version of the Yii framework. | yii\BaseYii |
info() |
Logs an informative message. | yii\BaseYii |
powered() |
Returns an HTML hyperlink that can be displayed on your Web page showing "Powered by Yii Framework" information. | yii\BaseYii |
setAlias() |
Registers a path alias. | yii\BaseYii |
setLogger() |
Sets the logger object. | yii\BaseYii |
t() |
Translates a message to the specified language. | yii\BaseYii |
trace() |
Alias of debug(). | yii\BaseYii |
warning() |
Logs a warning message. | yii\BaseYii |
Constant | Value | Description | Defined By |
---|---|---|---|
Client |
1 | Craft | |
Personal |
0 | Craft | |
Pro |
2 | Craft |
Property Details
$app
public static property
#
The application instance.
public static craft\web\Application, craft\console\Application $app = null
Method Details
autoload()
public static method
#
Class autoloader.
public static void autoload ( $className )
$className |
string |
cookieConfig()
public static method
#
Generates and returns a cookie config.
public static array cookieConfig ( array $config = [], yii\web\Request $request = null )
$config |
array | Any config options that should be included in the config. |
$request |
yii\web\Request, null | The request object |
return | array | The cookie config array. |
---|
createGuzzleClient()
public static method
#
Creates a Guzzle client configured with the given array merged with any default values in config/guzzle.php.
public static \GuzzleHttp\Client createGuzzleClient ( array $config = [] )
$config |
array | Guzzle client config settings |
dd()
public static method
#
Displays a variable and ends the request. (“Dump and die”)
public static void dd ( $var, \int $depth = 10, \bool $highlight = true )
$var |
mixed | The variable to be dumped. |
$depth |
integer | The maximum depth that the dumper should go into the variable. Defaults to 10. |
$highlight |
boolean | Whether the result should be syntax-highlighted. Defaults to true. |
throws | yii\base\ExitException | if the application is in testing mode |
---|
dump()
public static method
#
Displays a variable.
public static void dump ( $var, \int $depth = 10, \bool $highlight = true )
$var |
mixed | The variable to be dumped. |
$depth |
integer | The maximum depth that the dumper should go into the variable. Defaults to 10. |
$highlight |
boolean | Whether the result should be syntax-highlighted. Defaults to true. |