Path

Type
Class
Namespace
craft\services
Inherits
craft\services\Path » yii\base\Component » yii\base\BaseObject
Implements
yii\base\Configurable
Since
3.0

The Path service provides APIs for getting server paths that are used by Craft.

An instance of the Path service is globally accessible in Craft via Craft::$app->path.

View source

Public Properties

$assetSourcesPath

Type
string
Access
Read-only

View source

Signature

public string getAssetSourcesPath ( \craft\services\bool $create = true )

$assetThumbsPath

Type
string
Access
Read-only

View source

Signature

public string getAssetThumbsPath ( \craft\services\bool $create = true )

$assetsIconsPath

Type
string
Access
Read-only

View source

Signature

public string getAssetsIconsPath ( \craft\services\bool $create = true )

$assetsPath

Type
string
Access
Read-only

View source

Signature

public string getAssetsPath ( \craft\services\bool $create = true )

$cachePath

Type
string
Access
Read-only

View source

Signature

public string getCachePath ( \craft\services\bool $create = true )

$compiledClassesPath

Type
string
Access
Read-only

View source

Signature

public string getCompiledClassesPath ( \craft\services\bool $create = true )

$compiledTemplatesPath

Type
string
Access
Read-only

View source

Signature

public string getCompiledTemplatesPath ( \craft\services\bool $create = true )

$configPath

Type
string
Access
Read-only

View source

Signature

public string getConfigPath ( )

$cpTemplatesPath

Type
string
Access
Read-only

View source

Signature

public string getCpTemplatesPath ( )

$cpTranslationsPath

Type
string
Access
Read-only

View source

Signature

public string getCpTranslationsPath ( )

$dbBackupPath

Type
string
Access
Read-only

View source

Signature

public string getDbBackupPath ( \craft\services\bool $create = true )

$imageEditorSourcesPath

Type
string
Access
Read-only

View source

Signature

public string getImageEditorSourcesPath ( \craft\services\bool $create = true )

$licenseKeyPath

Type
string
Access
Read-only

View source

Signature

public string getLicenseKeyPath ( )

$logPath

Type
string
Access
Read-only

View source

Signature

public string getLogPath ( \craft\services\bool $create = true )

$pluginIconsPath

Type
string
Access
Read-only

View source

Signature

public string getPluginIconsPath ( \craft\services\bool $create = true )

$rebrandPath

Type
string
Access
Read-only

View source

Signature

public string getRebrandPath ( \craft\services\bool $create = true )

$runtimePath

Type
string
Access
Read-only

View source

Signature

public string getRuntimePath ( \craft\services\bool $create = true )

$sessionPath

Type
string
Access
Read-only

View source

Signature

public string getSessionPath ( \craft\services\bool $create = true )

$siteTemplatesPath

Type
string
Access
Read-only

View source

Signature

public string getSiteTemplatesPath ( )

$siteTranslationsPath

Type
string
Access
Read-only

View source

Signature

public string getSiteTranslationsPath ( )

$storagePath

Type
string
Access
Read-only

View source

Signature

public string getStoragePath ( )

$tempAssetUploadsPath

Type
string
Access
Read-only

View source

Signature

public string getTempAssetUploadsPath ( \craft\services\bool $create = true )

$tempPath

Type
string
Access
Read-only

View source

Signature

public string getTempPath ( \craft\services\bool $create = true )

$vendorPath

Type
string
Access
Read-only

View source

Signature

public string getVendorPath ( )

Public Methods

MethodDescription
__call()Calls the named method which is not a class method.
__clone()This method is called after the object is created by cloning an existing one.
__construct()Constructor.
__get()Returns the value of an object property.
__isset()Checks if a property is set, i.e. defined and not null.
__set()Sets value of an object property.
__unset()Sets an object property to null.
attachBehavior()Attaches a behavior to this component.
attachBehaviors()Attaches a list of behaviors to the component.
behaviors()Returns a list of behaviors that this component should behave as.
canGetProperty()Returns a value indicating whether a property can be read.
canSetProperty()Returns a value indicating whether a property can be set.
className()Returns the fully qualified name of this class.
detachBehavior()Detaches a behavior from the component.
detachBehaviors()Detaches all behaviors from the component.
ensureBehaviors()Makes sure that the behaviors declared in behaviors() are attached to this component.
getAssetSourcesPath()Returns the path to the storage/runtime/assets/sources/ directory.
getAssetThumbsPath()Returns the path to the storage/runtime/assets/thumbs/ directory.
getAssetsIconsPath()Returns the path to the storage/runtime/assets/icons/ directory.
getAssetsPath()Returns the path to the storage/runtime/assets/ directory.
getBehavior()Returns the named behavior object.
getBehaviors()Returns all behaviors attached to this component.
getCachePath()Returns the path to the file cache directory.
getCompiledClassesPath()Returns the path to the storage/runtime/compiled_classes/ directory.
getCompiledTemplatesPath()Returns the path to the storage/runtime/compiled_templates/ directory.
getConfigPath()Returns the path to the config/ directory.
getCpTemplatesPath()Returns the path to the app/templates/ directory.
getCpTranslationsPath()Returns the path to the app/translations/ directory.
getDbBackupPath()Returns the path to the storage/backups/ directory.
getImageEditorSourcesPath()Returns the path to the storage/runtime/assets/imageeditor/ folder.
getLicenseKeyPath()Returns the path to the license key file.
getLogPath()Returns the path to the storage/logs/ directory.
getPluginIconsPath()Returns the path to the storage/runtime/pluginicons/ directory.
getRebrandPath()Returns the path to the storage/rebrand/ directory.
getRuntimePath()Returns the path to the storage/runtime/ directory.
getSessionPath()Returns the path to the storage/runtime/sessions/ directory.
getSiteTemplatesPath()Returns the path to the templates/ directory.
getSiteTranslationsPath()Returns the path to the translations/ directory.
getStoragePath()Returns the path to the storage/ directory.
getTempAssetUploadsPath()Returns the path to the storage/runtime/assets/tempuploads/ directory.
getTempPath()Returns the path to the storage/runtime/temp/ directory.
getVendorPath()Returns the path to the vendor/ directory.
hasEventHandlers()Returns a value indicating whether there is any handler attached to the named event.
hasMethod()Returns a value indicating whether a method is defined.
hasProperty()Returns a value indicating whether a property is defined.
init()Initializes the object.
off()Detaches an existing event handler from this component.
on()Attaches an event handler to an event.
trigger()Triggers an event.

getAssetSourcesPath()

Returns the path to the storage/runtime/assets/sources/ directory.

View source

Arguments

  • $create (boolean) – Whether the directory should be created if it doesn't exist

Returns

string

Signature

public string getAssetSourcesPath ( \craft\services\bool $create = true )

getAssetThumbsPath()

Returns the path to the storage/runtime/assets/thumbs/ directory.

View source

Arguments

  • $create (boolean) – Whether the directory should be created if it doesn't exist

Returns

string

Signature

public string getAssetThumbsPath ( \craft\services\bool $create = true )

getAssetsIconsPath()

Returns the path to the storage/runtime/assets/icons/ directory.

View source

Arguments

  • $create (boolean) – Whether the directory should be created if it doesn't exist

Returns

string

Signature

public string getAssetsIconsPath ( \craft\services\bool $create = true )

getAssetsPath()

Returns the path to the storage/runtime/assets/ directory.

View source

Arguments

  • $create (boolean) – Whether the directory should be created if it doesn't exist

Returns

string

Signature

public string getAssetsPath ( \craft\services\bool $create = true )

getCachePath()

Returns the path to the file cache directory. This will be located at storage/runtime/cache/ by default, but that can be overridden with the 'cachePath' config setting in config/filecache.php.

View source

Arguments

  • $create (boolean) – Whether the directory should be created if it doesn't exist

Returns

string

Signature

public string getCachePath ( \craft\services\bool $create = true )

getCompiledClassesPath()

Returns the path to the storage/runtime/compiled_classes/ directory.

View source

Arguments

  • $create (boolean) – Whether the directory should be created if it doesn't exist

Returns

string

Signature

public string getCompiledClassesPath ( \craft\services\bool $create = true )

getCompiledTemplatesPath()

Returns the path to the storage/runtime/compiled_templates/ directory.

View source

Arguments

  • $create (boolean) – Whether the directory should be created if it doesn't exist

Returns

string

Signature

public string getCompiledTemplatesPath ( \craft\services\bool $create = true )

getConfigPath()

Returns the path to the config/ directory.

View source

Returns

string

Throws

Signature

public string getConfigPath ( )

getCpTemplatesPath()

Returns the path to the app/templates/ directory.

View source

Returns

string

Signature

public string getCpTemplatesPath ( )

getCpTranslationsPath()

Returns the path to the app/translations/ directory.

View source

Returns

string

Signature

public string getCpTranslationsPath ( )

getDbBackupPath()

Returns the path to the storage/backups/ directory.

View source

Arguments

  • $create (boolean) – Whether the directory should be created if it doesn't exist

Returns

string

Signature

public string getDbBackupPath ( \craft\services\bool $create = true )

getImageEditorSourcesPath()

Returns the path to the storage/runtime/assets/imageeditor/ folder.

View source

Arguments

  • $create (boolean) – Whether the directory should be created if it doesn't exist

Returns

string

Signature

public string getImageEditorSourcesPath ( \craft\services\bool $create = true )

getLicenseKeyPath()

Returns the path to the license key file.

View source

Returns

string

Signature

public string getLicenseKeyPath ( )

getLogPath()

Returns the path to the storage/logs/ directory.

View source

Arguments

  • $create (boolean) – Whether the directory should be created if it doesn't exist

Returns

string

Signature

public string getLogPath ( \craft\services\bool $create = true )

getPluginIconsPath()

Returns the path to the storage/runtime/pluginicons/ directory.

View source

Arguments

  • $create (boolean) – Whether the directory should be created if it doesn't exist

Returns

string

Signature

public string getPluginIconsPath ( \craft\services\bool $create = true )

getRebrandPath()

Returns the path to the storage/rebrand/ directory.

View source

Arguments

  • $create (boolean) – Whether the directory should be created if it doesn't exist

Returns

string

Signature

public string getRebrandPath ( \craft\services\bool $create = true )

getRuntimePath()

Returns the path to the storage/runtime/ directory.

View source

Arguments

  • $create (boolean) – Whether the directory should be created if it doesn't exist

Returns

string

Signature

public string getRuntimePath ( \craft\services\bool $create = true )

getSessionPath()

Returns the path to the storage/runtime/sessions/ directory.

View source

Arguments

  • $create (boolean) – Whether the directory should be created if it doesn't exist

Returns

string

Signature

public string getSessionPath ( \craft\services\bool $create = true )

getSiteTemplatesPath()

Returns the path to the templates/ directory.

View source

Returns

string

Throws

Signature

public string getSiteTemplatesPath ( )

getSiteTranslationsPath()

Returns the path to the translations/ directory.

View source

Returns

string

Throws

Signature

public string getSiteTranslationsPath ( )

getStoragePath()

Returns the path to the storage/ directory.

View source

Returns

string

Throws

Signature

public string getStoragePath ( )

getTempAssetUploadsPath()

Returns the path to the storage/runtime/assets/tempuploads/ directory.

View source

Arguments

  • $create (boolean) – Whether the directory should be created if it doesn't exist

Returns

string

Signature

public string getTempAssetUploadsPath ( \craft\services\bool $create = true )

getTempPath()

Returns the path to the storage/runtime/temp/ directory.

View source

Arguments

  • $create (boolean) – Whether the directory should be created if it doesn't exist

Returns

string

Signature

public string getTempPath ( \craft\services\bool $create = true )

getVendorPath()

Returns the path to the vendor/ directory.

View source

Returns

string

Throws

Signature

public string getVendorPath ( )