Path

Type
Class
Namespace
craft\services
Inherits
craft\services\Path » yii\base\Component (opens new window) » yii\base\BaseObject (opens new window)
Implements
yii\base\Configurable (opens new window)
Since
3.0.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 (opens new window)

# Public Properties

# assetSourcesPath

Type
string (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# assetThumbsPath

Type
string (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# assetsIconsPath

Type
string (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# assetsPath

Type
string (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# cachePath

Type
string (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# compiledClassesPath

Type
string (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# compiledTemplatesPath

Type
string (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# composerBackupsPath

Type
string (opens new window)
Default value
null
Access
Read-only
Since
3.0.38

View source (opens new window)

# configBackupPath

Type
string (opens new window)
Default value
null
Access
Read-only
Since
3.1.0

View source (opens new window)

# configDeltaPath

Type
string (opens new window)
Default value
null
Access
Read-only
Since
3.4.0

View source (opens new window)

# configPath

Type
string (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# cpTemplatesPath

Type
string (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# cpTranslationsPath

Type
string (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# dbBackupPath

Type
string (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# imageEditorSourcesPath

Type
string (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# licenseKeyPath

Type
string (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# logPath

Type
string (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# pluginIconsPath

Type
string (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# projectConfigFilePath

Type
string (opens new window)
Default value
null
Access
Read-only
Since
3.1.2

View source (opens new window)

# projectConfigPath

Type
string (opens new window)
Default value
null
Access
Read-only
Since
3.5.0

View source (opens new window)

# rebrandPath

Type
string (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# runtimePath

Type
string (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# sessionPath

Type
string (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# siteTemplatesPath

Type
string (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# siteTranslationsPath

Type
string (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# storagePath

Type
string (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# tempAssetUploadsPath

Type
string (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# tempPath

Type
string (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# testsPath

Type
string (opens new window)
Default value
null
Access
Read-only
Since
3.4.29

View source (opens new window)

# vendorPath

Type
string (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# Public Methods

Method Description
__call() (opens new window) Calls the named method which is not a class method.
__clone() (opens new window) This method is called after the object is created by cloning an existing one.
__construct() (opens new window) Constructor.
__get() (opens new window) Returns the value of an object property.
__isset() (opens new window) Checks if a property is set, i.e. defined and not null.
__set() (opens new window) Sets value of an object property.
__unset() (opens new window) Sets an object property to null.
attachBehavior() (opens new window) Attaches a behavior to this component.
attachBehaviors() (opens new window) Attaches a list of behaviors to the component.
behaviors() (opens new window) Returns a list of behaviors that this component should behave as.
canGetProperty() (opens new window) Returns a value indicating whether a property can be read.
canSetProperty() (opens new window) Returns a value indicating whether a property can be set.
className() (opens new window) Returns the fully qualified name of this class.
detachBehavior() (opens new window) Detaches a behavior from the component.
detachBehaviors() (opens new window) Detaches all behaviors from the component.
ensureBehaviors() (opens new window) Makes sure that the behaviors declared in behaviors() (opens new window) 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() (opens new window) Returns the named behavior object.
getBehaviors() (opens new window) 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.
getComposerBackupsPath() Returns the path to the storage/composer-backups/ directory.
getConfigBackupPath() Returns the path to the storage/config-backups/ directory.
getConfigDeltaPath() Returns the path to the storage/config-deltas/ 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.
getProjectConfigFilePath() Returns the path to config/project/project.yaml.
getProjectConfigPath() Returns the path to config/project/ 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.
getTestsPath() Returns the path to the tests/ directory.
getVendorPath() Returns the path to the vendor/ directory.
hasEventHandlers() (opens new window) Returns a value indicating whether there is any handler attached to the named event.
hasMethod() (opens new window) Returns a value indicating whether a method is defined.
hasProperty() (opens new window) Returns a value indicating whether a property is defined.
init() (opens new window) Initializes the object.
off() (opens new window) Detaches an existing event handler from this component.
on() (opens new window) Attaches an event handler to an event.
trigger() (opens new window) Triggers an event.

# getAssetSourcesPath()

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

View source (opens new window)

Arguments

Returns

string (opens new window)

# getAssetThumbsPath()

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

View source (opens new window)

Arguments

Returns

string (opens new window)

# getAssetsIconsPath()

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

View source (opens new window)

Arguments

Returns

string (opens new window)

# getAssetsPath()

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

View source (opens new window)

Arguments

Returns

string (opens new window)

# 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 (opens new window)

Arguments

Returns

string (opens new window)

# getCompiledClassesPath()

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

View source (opens new window)

Arguments

Returns

string (opens new window)

# getCompiledTemplatesPath()

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

View source (opens new window)

Arguments

Returns

string (opens new window)

# getComposerBackupsPath()

Since
3.0.38

Returns the path to the storage/composer-backups/ directory.

View source (opens new window)

Arguments

Returns

string (opens new window)

Throws

# getConfigBackupPath()

Since
3.1.0

Returns the path to the storage/config-backups/ directory.

View source (opens new window)

Arguments

Returns

string (opens new window)

Throws

# getConfigDeltaPath()

Since
3.4.0

Returns the path to the storage/config-deltas/ directory.

View source (opens new window)

Arguments

Returns

string (opens new window)

Throws

# getConfigPath()

Returns the path to the config/ directory.

View source (opens new window)

Returns

string (opens new window)

Throws

# getCpTemplatesPath()

Returns the path to the app/templates/ directory.

View source (opens new window)

Returns

string (opens new window)

# getCpTranslationsPath()

Returns the path to the app/translations/ directory.

View source (opens new window)

Returns

string (opens new window)

# getDbBackupPath()

Returns the path to the storage/backups/ directory.

View source (opens new window)

Arguments

Returns

string (opens new window)

Throws

# getImageEditorSourcesPath()

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

View source (opens new window)

Arguments

Returns

string (opens new window)

# getLicenseKeyPath()

Returns the path to the license key file.

View source (opens new window)

Returns

string (opens new window)

# getLogPath()

Returns the path to the storage/logs/ directory.

View source (opens new window)

Arguments

Returns

string (opens new window)

Throws

# getPluginIconsPath()

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

View source (opens new window)

Arguments

Returns

string (opens new window)

# getProjectConfigFilePath()

Since
3.1.2

Returns the path to config/project/project.yaml.

View source (opens new window)

Returns

string (opens new window)

# getProjectConfigPath()

Since
3.5.0

Returns the path to config/project/ directory.

View source (opens new window)

Arguments

Returns

string (opens new window)

Throws

# getRebrandPath()

Returns the path to the storage/rebrand/ directory.

View source (opens new window)

Arguments

Returns

string (opens new window)

Throws

# getRuntimePath()

Returns the path to the storage/runtime/ directory.

View source (opens new window)

Arguments

Returns

string (opens new window)

Throws

# getSessionPath()

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

View source (opens new window)

Arguments

Returns

string (opens new window)

# getSiteTemplatesPath()

Returns the path to the templates/ directory.

View source (opens new window)

Returns

string (opens new window)

Throws

# getSiteTranslationsPath()

Returns the path to the translations/ directory.

View source (opens new window)

Returns

string (opens new window)

Throws

# getStoragePath()

Returns the path to the storage/ directory.

View source (opens new window)

Arguments

Returns

string (opens new window)

Throws

# getTempAssetUploadsPath()

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

View source (opens new window)

Arguments

Returns

string (opens new window)

# getTempPath()

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

View source (opens new window)

Arguments

Returns

string (opens new window)

# getTestsPath()

Since
3.4.29

Returns the path to the tests/ directory.

View source (opens new window)

Returns

string (opens new window)

Throws

# getVendorPath()

Returns the path to the vendor/ directory.

View source (opens new window)

Returns

string (opens new window)

Throws