Craft

Type
Class
Inherits
Craft » Yii
Since
3.0

Craft is helper class serving common Craft and Yii framework functionality.

It encapsulates \Yii and ultimately yii\BaseYii, which provides the actual implementation.

View source

Public Properties

PropertyDescription
$appcraft\web\Application, craft\console\Application – The application instance.

$app

Signature

public static craft\web\Application, craft\console\Application $app = null

Public Methods

MethodDescription
autoload()Class autoloader.
cookieConfig()Generates and returns a cookie config.
createGuzzleClient()Creates a Guzzle client configured with the given array merged with any default values in config/guzzle.php.
dd()Displays a variable and ends the request. (“Dump and die”)
dump()Displays a variable.

autoload()

Class autoloader.

View source

Arguments

Signature

public static void autoload ( $className )

cookieConfig()

Generates and returns a cookie config.

View source

Arguments

  • $config (array) – Any config options that should be included in the config.
  • $request (yii\web\Request, null) – The request object

Returns

array – The cookie config array.

Signature

public static array cookieConfig ( array $config = [], yii\web\Request $request = null )

createGuzzleClient()

Creates a Guzzle client configured with the given array merged with any default values in config/guzzle.php.

View source

Arguments

  • $config (array) – Guzzle client config settings

Returns

\GuzzleHttp\Client

Signature

public static \GuzzleHttp\Client createGuzzleClient ( array $config = [] )

dd()

Displays a variable and ends the request. (“Dump and die”)

View source

Arguments

  • $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

Signature

public static void dd ( $var, \int $depth = 10, \bool $highlight = true )

dump()

Displays a variable.

View source

Arguments

  • $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.

Signature

public static void dump ( $var, \int $depth = 10, \bool $highlight = true )

Constants

ConstantDescription
Client
Personal
Pro
Solo