GeneralConfig

Type
Class
Namespace
craft\config
Inherits
craft\config\GeneralConfig » yii\base\BaseObject
Implements
yii\base\Configurable
Since
3.0

General config class

View source

Public Properties

PropertyDescription
$actionTriggerstring – The URI segment Craft should look for when determining if the current request should first be routed to a controller action.
$activateAccountSuccessPathmixed – The URI that users without access to the Control Panel should be redirected to after activating their account.
$addTrailingSlashesToUrlsboolean – Whether auto-generated URLs should have trailing slashes.
$aliasesarray – Any custom Yii [aliases](https://www.
$allowSimilarTagsboolean – Whether users should be allowed to create similarly-named tags.
$allowUpdatesboolean – Whether Craft should allow system and plugin updates in the Control Panel, and plugin installation from the Plugin Store.
$allowUppercaseInSlugboolean – Whether uppercase letters should be allowed in slugs.
$allowedFileExtensionsstring[] – The file extensions Craft should allow when a user is uploading files.
$autoLoginAfterAccountActivationboolean – Whether users should automatically be logged in after activating their account.
$backupCommandstring, null – The shell command that Craft should execute to create a database backup.
$backupOnUpdateboolean – Whether Craft should create a database backup before applying a new system update.
$baseCpUrlstring, null – The base URL that Craft should use when generating Control Panel URLs.
$blowfishHashCostinteger – The higher the cost value, the longer it takes to generate a password hash and to verify against it.
$cacheDurationmixed – The default length of time Craft will store data, RSS feed, and template caches.
$cacheElementQueriesboolean – Whether Craft should cache element queries that fall inside {% cache %} tags.
$convertFilenamesToAsciiboolean – Whether uploaded filenames with non-ASCII characters should be converted to ASCII (i.e. ñn).
$cooldownDurationmixed – The amount of time a user must wait before re-attempting to log in after their account is locked due to too many failed login attempts.
$cpTriggerstring – The URI segment Craft should look for when determining if the current request should route to the Control Panel rather than the front-end website.
$csrfTokenNamestring – The name of CSRF token used for CSRF validation if $enableCsrfProtection is set to true.
$customAsciiCharMappingsarray – Any custom ASCII character mappings.
$defaultCookieDomainstring – The domain that cookies generated by Craft should be created for.
$defaultCpLanguagestring, null – The default language the Control Panel should use for users who haven’t set a preferred language yet.
$defaultDirModemixed – The default permission to be set for newly generated directories.
$defaultFileModeinteger, null – The default permission to be set for newly generated files.
$defaultImageQualityinteger – The quality level Craft will use when saving JPG and PNG files.
$defaultSearchTermOptionsarray – The default options that should be applied to each search term.
$defaultTemplateExtensionsstring[] – The template file extensions Craft will look for when matching a template path to a file on the front end.
$defaultTokenDurationmixed – The default amount of time tokens can be used before expiring.
$defaultWeekStartDayinteger – The default day that new users should have set as their Week Start Day.
$deferPublicRegistrationPasswordboolean – By default, Craft will require a 'password' field to be submitted on front-end, public user registrations.
$devModeboolean – Whether the system should run in [Dev Mode](https://craftcms.
$elevatedSessionDurationmixed – The amount of time a user’s elevated session will last, which is required for some sensitive actions (e.g. user group/permission assignment).
$enableCsrfCookieboolean – Whether to use a cookie to persist the CSRF token if $enableCsrfProtection is enabled.
$enableCsrfProtectionboolean – Whether to enable CSRF protection via hidden form inputs for all forms submitted via Craft.
$enableTemplateCachingboolean – Whether to enable Craft's template {% cache %} tag on a global basis.
$errorTemplatePrefixstring – The prefix that should be prepended to HTTP error status codes when determining the path to look for an error’s template.
$extraAllowedFileExtensionsstring[], null – List of file extensions that will be merged into the $allowedFileExtensions config setting.
$extraAppLocalesstring[], null – List of extra locale IDs that the application should support, and users should be able to select as their Preferred Language.
$filenameWordSeparatorstring, boolean – The string to use to separate words when uploading Assets.
$generateTransformsBeforePageLoadboolean – Whether images transforms should be generated before page load.
$imageDrivermixed – The image driver Craft should use to cleanse and transform images.
$indexTemplateFilenamesstring[] – The template filenames Craft will look for within a directory to represent the directory’s “index” template when matching a template path to a file on the front end.
$invalidLoginWindowDurationmixed – The amount of time to track invalid login attempts for a user, for determining if Craft should lock an account.
$invalidUserTokenPathmixed – The URI Craft should redirect to when user token validation fails.
$ipHeadersstring[], null – List of headers where proxies store the real client IP.
$isSystemOnboolean, null – Whether the site is currently online or not.
$limitAutoSlugsToAsciiboolean – Whether non-ASCII characters in auto-generated slugs should be converted to ASCII (i.e. ñ → n).
$loginPathmixed – The URI Craft should use for user login on the front-end.
$logoutPathmixed – The URI Craft should use for user logout on the front-end.
$maxCachedCloudImageSizeinteger – The maximum dimension size to use when caching images from external sources to use in transforms.
$maxInvalidLoginsinteger – The number of invalid login attempts Craft will allow within the specified duration before the account gets locked.
$maxSlugIncrementinteger – The highest number Craft will tack onto a slug in order to make it unique before giving up and throwing an error.
$maxUploadFileSizeinteger, string – The maximum upload file size allowed.
$omitScriptNameInUrlsboolean – Whether generated URLs should omit `index.
$optimizeImageFilesizeboolean – Whether Craft should optimize images for reduced file sizes without noticeably reducing image quality.
$pageTriggerstring – The string preceding a number which Craft will look for when determining if the current request is for a particular page in a paginated list of pages.
$pathParamstring – The query string param that Craft will check when determining the request's path.
$phpMaxMemoryLimitstring – The maximum amount of memory Craft will try to reserve during memory intensive operations such as zipping, unzipping and updating.
$phpSessionNamestring – The name of the PHP session cookie.
$postCpLoginRedirectmixed – The path that users should be redirected to after logging in from the Control Panel.
$postLoginRedirectmixed – The path that users should be redirected to after logging in from the front-end site.
$postLogoutRedirectmixed – The path that users should be redirected to after logging out from the front-end site.
$preserveCmykColorspaceboolean – Whether CMYK should be preserved as the colorspace when when manipulating images.
$preserveExifDataboolean – Whether the EXIF data should be preserved when manipulating images.
$preserveImageColorProfilesboolean – Whether the embedded Image Color Profile (ICC) should be preserved when manipulating images.
$preventUserEnumerationboolean – When set to false and you go through the "forgot password" workflow on the Control Panel login page, for example, you get distinct messages saying if the username/email didn't exist or the email was successfully sent and to check your email for further instructions.
$privateTemplateTriggerstring – The template path segment prefix that should be used to identify "private" templates (templates that aren't directly accessible via a matching URL).
$purgePendingUsersDurationmixed – The amount of time to wait before Craft purges pending users from the system that have not activated.
$rememberUsernameDurationmixed – The amount of time Craft will remember a username and pre-populate it on the CP login page.
$rememberedUserSessionDurationmixed – The amount of time a user stays logged if “Remember Me” is checked on the login page.
$requireMatchingUserAgentForSessionboolean – Whether Craft should require a matching user agent string when restoring a user session from a cookie.
$requireUserAgentAndIpForSessionboolean – Whether Craft should require the existence of a user agent string and IP address when creating a new user session.
$resourceBasePathstring – The path to the root directory that should store published CP resources.
$resourceBaseUrlstring – The URL to the root directory that should store published CP resources.
$restoreCommandstring, null – The shell command that Craft should execute to restore a database backup.
$rotateImagesOnUploadByExifDataboolean – Whether Craft should rotate images according to their EXIF data on upload.
$runQueueAutomaticallyboolean – Whether Craft should run pending queue jobs automatically over HTTP requests.
$sanitizeSvgUploadsboolean – Whether Craft should sanitize uploaded SVG files and strip out potential malicious looking content.
$secureHeadersarray, null – Lists of headers that are, by default, subject to the trusted host configuration.
$secureProtocolHeadersarray, null – List of headers to check for determining whether the connection is made via HTTPS.
$securityKeystring – A private, random, cryptographically-secure key that is used for hashing and encrypting data in craft\services\Security.
$sendPoweredByHeaderboolean – Whether an X-Powered-By: Craft CMS header should be sent, helping services like [BuiltWith](https://builtwith.
$setPasswordPathmixed – The password-reset template path.
$setPasswordSuccessPathmixed – The URI Craft should redirect users to after setting their password from the front-end.
$siteNamestring, string[] – The site name(s).
$siteUrlstring, string[] – The base URL to the site(s).
$slugWordSeparatorstring – The character(s) that should be used to separate words in slugs.
$suppressTemplateErrorsboolean – Whether Twig runtime errors should be suppressed.
$testToEmailAddressstring, array, null – Configures Craft to send all system emails to a single email address, or an array of email addresses for testing purposes.
$timezonestring, null – The timezone of the site.
$tokenParamstring – The query string parameter name that tokens should be set to.
$transformGifsboolean – Whether GIF files should be cleansed/transformed.
$translationDebugOutputboolean – Whether translated messages should be wrapped in special characters, to help find any strings that are not being run through Craft::t() or the |translate filter.
$trustedHostsarray – The configuration for trusted security-related headers.
$useCompressedJsboolean – Whether Craft should use compressed JavaScript files whenever possible.
$useEmailAsUsernameboolean – Whether Craft should set users’ usernames to their email addresses, rather than let them set their username separately.
$useFileLocksboolean, null – Whether to grab an exclusive lock on a file when writing to it by using the LOCK_EX flag.
$usePathInfoboolean – Whether Craft should specify the path using PATH_INFO or as a query string parameter when generating URLs.
$useSecureCookiesboolean, string – Whether Craft will set the "secure" flag when saving cookies when using Craft::cookieConfig() to create a cookie.
$useSslOnTokenizedUrlsboolean, string – Determines what protocol/schema Craft will use when generating tokenized URLs.
$userSessionDurationmixed – The amount of time before a user will get logged out due to inactivity.
$verificationCodeDurationmixed – The amount of time a user verification code can be used before expiring.

$actionTrigger

Type
string

The URI segment Craft should look for when determining if the current request should first be routed to a controller action.

View source

Signature

public string $actionTrigger = 'actions'

$activateAccountSuccessPath

Type
mixed
Access
Read-only

The URI that users without access to the Control Panel should be redirected to after activating their account.

See craft\helpers\ConfigHelper::localizedValue() for a list of supported value types.

See also getActivateAccountSuccessPath()

View source

Signature

public string getActivateAccountSuccessPath ( \craft\config\string $siteHandle = null )

$addTrailingSlashesToUrls

Type
boolean

Whether auto-generated URLs should have trailing slashes.

View source

Signature

public boolean $addTrailingSlashesToUrls = false

$aliases

Type
array

Any custom Yii aliases that should be defined for every request.

View source

Signature

public array $aliases = []

$allowSimilarTags

Type
boolean

Whether users should be allowed to create similarly-named tags.

View source

Signature

public boolean $allowSimilarTags = false

$allowUpdates

Type
boolean

Whether Craft should allow system and plugin updates in the Control Panel, and plugin installation from the Plugin Store.

View source

Signature

public boolean $allowUpdates = true

$allowUppercaseInSlug

Type
boolean

Whether uppercase letters should be allowed in slugs.

View source

Signature

public boolean $allowUppercaseInSlug = false

$allowedFileExtensions

Type
string[]

The file extensions Craft should allow when a user is uploading files.

See also $extraAllowedFileExtensions

View source

Signature

public string[] $allowedFileExtensions = ['7z', 'aiff', 'asf', 'avi', 'bmp', 'csv', 'doc', 'docx', 'fla', 'flv', 'gif', 'gz', 'gzip', 'htm', 'html', 'jp2', 'jpeg', 'jpg', 'jpx', 'js', 'json', 'm2t', 'mid', 'mov', 'mp3', 'mp4', 'm4a', 'm4v', 'mpc', 'mpeg', 'mpg', 'ods', 'odt', 'ogg', 'ogv', 'pdf', 'png', 'potx', 'pps', 'ppsm', 'ppsx', 'ppt', 'pptm', 'pptx', 'ppz', 'pxd', 'qt', 'ram', 'rar', 'rm', 'rmi', 'rmvb', 'rtf', 'sdc', 'sitd', 'svg', 'swf', 'sxc', 'sxw', 'tar', 'tgz', 'tif', 'tiff', 'txt', 'vob', 'vsd', 'wav', 'webm', 'webp', 'wma', 'wmv', 'xls', 'xlsx', 'zip']

$autoLoginAfterAccountActivation

Type
boolean

Whether users should automatically be logged in after activating their account.

View source

Signature

public boolean $autoLoginAfterAccountActivation = false

$backupCommand

Type
string, null

The shell command that Craft should execute to create a database backup.

By default Craft will run mysqldump or pg_dump, provided that those libraries are in the $PATH variable for the user the web server is running as.

There are several tokens you can use that Craft will swap out at runtime:

  • {path} - the target backup file path
  • {port} - the current database port
  • {server} - the current database host name
  • {user} - the user to connect to the database
  • {database} - the current database name
  • {schema} - the current database schema (if any)

This can also be set to false to disable database backups completely.

View source

Signature

public string, null $backupCommand = null

$backupOnUpdate

Type
boolean
Access
Read-only

Whether Craft should create a database backup before applying a new system update.

See also $backupCommand

View source

Signature

public boolean getBackupOnUpdate ( )

$baseCpUrl

Type
string, null

The base URL that Craft should use when generating Control Panel URLs.

It will be determined automatically if left blank.

TIP

The base CP URL should not include the CP trigger word (e.g. /admin).

View source

Signature

public string, null $baseCpUrl = null

$blowfishHashCost

Type
integer

The higher the cost value, the longer it takes to generate a password hash and to verify against it. Therefore, higher cost slows down a brute-force attack.

For best protection against brute force attacks, set it to the highest value that is tolerable on production servers.

The time taken to compute the hash doubles for every increment by one for this value. For example, if the hash takes 1 second to compute when the value is 14 then the compute time varies as 2^(value - 14) seconds.

View source

Signature

public integer $blowfishHashCost = 13

$cacheDuration

Type
mixed

The default length of time Craft will store data, RSS feed, and template caches.

If set to 0, data and RSS feed caches will be stored indefinitely; template caches will be stored for one year.

See craft\helpers\ConfigHelper::durationInSeconds() for a list of supported value types.

View source

Signature

public mixed $cacheDuration = 86400

$cacheElementQueries

Type
boolean

Whether Craft should cache element queries that fall inside {% cache %} tags.

View source

Signature

public boolean $cacheElementQueries = true

$convertFilenamesToAscii

Type
boolean

Whether uploaded filenames with non-ASCII characters should be converted to ASCII (i.e. ñn).

View source

Signature

public boolean $convertFilenamesToAscii = false

$cooldownDuration

Type
mixed

The amount of time a user must wait before re-attempting to log in after their account is locked due to too many failed login attempts.

Set to 0 to keep the account locked indefinitely, requiring an admin to manually unlock the account.

See craft\helpers\ConfigHelper::durationInSeconds() for a list of supported value types.

View source

Signature

public mixed $cooldownDuration = 300

$cpTrigger

Type
string

The URI segment Craft should look for when determining if the current request should route to the Control Panel rather than the front-end website.

View source

Signature

public string $cpTrigger = 'admin'

$csrfTokenName

Type
string

The name of CSRF token used for CSRF validation if $enableCsrfProtection is set to true.

See also $enableCsrfProtection

View source

Signature

public string $csrfTokenName = 'CRAFT_CSRF_TOKEN'

$customAsciiCharMappings

DEPRECATED

Deprecated in 3.0.10. Any corrections to ASCII char mappings should be submitted to Stringy.

Type
array

Any custom ASCII character mappings.

This array is merged into the default one in StringHelper::asciiCharMap(). The key is the ASCII character to be used for the replacement and the value is an array of non-ASCII characters that the key maps to.

View source

Signature

public array $customAsciiCharMappings = []

Example

$defaultCookieDomain

Type
string

The domain that cookies generated by Craft should be created for. If blank, it will be left up to the browser to determine which domain to use (almost always the current). If you want the cookies to work for all subdomains, for example, you could set this to '.domain.com'.

View source

Signature

public string $defaultCookieDomain = ''

$defaultCpLanguage

Type
string, null

The default language the Control Panel should use for users who haven’t set a preferred language yet.

View source

Signature

public string, null $defaultCpLanguage = null

$defaultDirMode

Type
mixed

The default permission to be set for newly generated directories.

If set to null, the permission will be determined by the current environment.

View source

Signature

public mixed $defaultDirMode = 0775

$defaultFileMode

Type
integer, null

The default permission to be set for newly generated files.

If set to null, the permission will be determined by the current environment.

View source

Signature

public integer, null $defaultFileMode = null

$defaultImageQuality

Type
integer

The quality level Craft will use when saving JPG and PNG files. Ranges from 0 (worst quality, smallest file) to 100 (best quality, biggest file).

View source

Signature

public integer $defaultImageQuality = 82

$defaultSearchTermOptions

Type
array

The default options that should be applied to each search term.

Options include:

  • attribute – The attribute that the term should apply to (e.g. 'title'), if any. (null by default)
  • exact – Whether the term must be an exact match (only applies if attribute is set). (false by default)
  • exclude – Whether search results should exclude records with this term. (false by default)
  • subLeft – Whether to include keywords that contain the term, with additional characters before it. (false by default)
  • subRight – Whether to include keywords that contain the term, with additional characters after it. (true by default)

View source

Signature

public array $defaultSearchTermOptions = []

$defaultTemplateExtensions

Type
string[]

The template file extensions Craft will look for when matching a template path to a file on the front end.

View source

Signature

public string[] $defaultTemplateExtensions = ['html', 'twig']

$defaultTokenDuration

Type
mixed

The default amount of time tokens can be used before expiring.

See craft\helpers\ConfigHelper::durationInSeconds() for a list of supported value types.

View source

Signature

public mixed $defaultTokenDuration = 86400

$defaultWeekStartDay

Type
integer

The default day that new users should have set as their Week Start Day.

This should be set to one of the following integers:

  • 0 – Sunday
  • 1 – Monday
  • 2 – Tuesday
  • 3 – Wednesday
  • 4 – Thursday
  • 5 – Friday
  • 6 – Saturday

View source

Signature

public integer $defaultWeekStartDay = 0

$deferPublicRegistrationPassword

Type
boolean

By default, Craft will require a 'password' field to be submitted on front-end, public user registrations. Setting this to true will no longer require it on the initial registration form.

If you have email verification enabled, new users will set their password once they've clicked on the verification link in the email. If you don't, the only way they can set their password is to go through your "forgot password" workflow.

View source

Signature

public boolean $deferPublicRegistrationPassword = false

$devMode

Type
boolean

Whether the system should run in Dev Mode.

View source

Signature

public boolean $devMode = false

$elevatedSessionDuration

Type
mixed

The amount of time a user’s elevated session will last, which is required for some sensitive actions (e.g. user group/permission assignment).

Set to 0 to disable elevated session support.

See craft\helpers\ConfigHelper::durationInSeconds() for a list of supported value types.

View source

Signature

public mixed $elevatedSessionDuration = 300

$enableCsrfCookie

Type
boolean

Whether to use a cookie to persist the CSRF token if $enableCsrfProtection is enabled. If false, the CSRF token will be stored in session under the 'csrfTokenName' config setting name. Note that while storing CSRF tokens in session increases security, it requires starting a session for every page that a CSRF token is need, which may degrade site performance.

See also $enableCsrfProtection

View source

Signature

public boolean $enableCsrfCookie = true

$enableCsrfProtection

Type
boolean

Whether to enable CSRF protection via hidden form inputs for all forms submitted via Craft.

See also:

View source

Signature

public boolean $enableCsrfProtection = true

$enableTemplateCaching

Type
boolean

Whether to enable Craft's template {% cache %} tag on a global basis.

See also http://craftcms.com/docs/templating/cache

View source

Signature

public boolean $enableTemplateCaching = true

$errorTemplatePrefix

Type
string

The prefix that should be prepended to HTTP error status codes when determining the path to look for an error’s template.

If set to '_', then your site’s 404 template would live at templates/_404.html, for example.

View source

Signature

public string $errorTemplatePrefix = ''

$extraAllowedFileExtensions

Type
string[], null

List of file extensions that will be merged into the $allowedFileExtensions config setting.

See also $allowedFileExtensions

View source

Signature

public string[], null $extraAllowedFileExtensions = null

$extraAppLocales

Type
string[], null

List of extra locale IDs that the application should support, and users should be able to select as their Preferred Language.

Only use this setting if your server has the Intl PHP extension, or if you’ve saved the corresponding locale data into your config/locales/ folder.

View source

Signature

public string[], null $extraAppLocales = null

$filenameWordSeparator

Type
string, boolean

The string to use to separate words when uploading Assets. If set to false, spaces will be left alone.

View source

Signature

public string, boolean $filenameWordSeparator = '-'

$generateTransformsBeforePageLoad

Type
boolean

Whether images transforms should be generated before page load.

View source

Signature

public boolean $generateTransformsBeforePageLoad = false

$imageDriver

Type
mixed

The image driver Craft should use to cleanse and transform images. By default Craft will auto-detect if ImageMagick is installed and fallback to GD if not. You can explicitly set either 'imagick' or 'gd' here to override that behavior.

View source

Signature

public mixed $imageDriver = self::IMAGE_DRIVER_AUTO

$indexTemplateFilenames

Type
string[]

The template filenames Craft will look for within a directory to represent the directory’s “index” template when matching a template path to a file on the front end.

View source

Signature

public string[] $indexTemplateFilenames = ['index']

$invalidLoginWindowDuration

Type
mixed

The amount of time to track invalid login attempts for a user, for determining if Craft should lock an account.

See craft\helpers\ConfigHelper::durationInSeconds() for a list of supported value types.

View source

Signature

public mixed $invalidLoginWindowDuration = 3600

$invalidUserTokenPath

Type
mixed
Access
Read-only

The URI Craft should redirect to when user token validation fails. A token is used on things like setting and resetting user account passwords. Note that this only affects front-end site requests.

See craft\helpers\ConfigHelper::localizedValue() for a list of supported value types.

See also getInvalidUserTokenPath()

View source

Signature

public string getInvalidUserTokenPath ( \craft\config\string $siteHandle = null )

$ipHeaders

Type
string[], null

List of headers where proxies store the real client IP.

See yii\web\Request::$ipHeaders for more details.

If not set, the default craft\web\Request::$ipHeaders value will be used.

View source

Signature

public string[], null $ipHeaders = null

$isSystemOn

Type
boolean, null

Whether the site is currently online or not. If set to true or false, it will take precedence over the System Status setting in Settings → General.

View source

Signature

public boolean, null $isSystemOn = null

$limitAutoSlugsToAscii

Type
boolean

Whether non-ASCII characters in auto-generated slugs should be converted to ASCII (i.e. ñ → n).

TIP

This only affects the JavaScript auto-generated slugs. Non-ASCII characters can still be used in slugs if entered manually.

View source

Signature

public boolean $limitAutoSlugsToAscii = false

$loginPath

Type
mixed
Access
Read-only

The URI Craft should use for user login on the front-end.

See craft\helpers\ConfigHelper::localizedValue() for a list of supported value types.

See also getLoginPath()

View source

Signature

public string getLoginPath ( \craft\config\string $siteHandle = null )

$logoutPath

Type
mixed
Access
Read-only

The URI Craft should use for user logout on the front-end.

See craft\helpers\ConfigHelper::localizedValue() for a list of supported value types.

See also getLogoutPath()

View source

Signature

public string getLogoutPath ( \craft\config\string $siteHandle = null )

$maxCachedCloudImageSize

Type
integer

The maximum dimension size to use when caching images from external sources to use in transforms. Set to 0 to never cache them.

View source

Signature

public integer $maxCachedCloudImageSize = 2000

$maxInvalidLogins

Type
integer

The number of invalid login attempts Craft will allow within the specified duration before the account gets locked.

View source

Signature

public integer $maxInvalidLogins = 5

$maxSlugIncrement

Type
integer

The highest number Craft will tack onto a slug in order to make it unique before giving up and throwing an error.

View source

Signature

public integer $maxSlugIncrement = 100

$maxUploadFileSize

Type
integer, string

The maximum upload file size allowed.

See craft\helpers\ConfigHelper::sizeInBytes() for a list of supported value types.

View source

Signature

public integer, string $maxUploadFileSize = 16777216

$omitScriptNameInUrls

Type
boolean

Whether generated URLs should omit index.php (e.g. http://domain.com/path instead of http://domain.com/index.php/path)

This can only be possible if your server is configured to redirect would-be 404's to index.php, for example, with the redirect found in the .htaccess file that came with Craft:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.+) /index.php?p=$1 [QSA,L]

View source

Signature

public boolean $omitScriptNameInUrls = false

$optimizeImageFilesize

Type
boolean

Whether Craft should optimize images for reduced file sizes without noticeably reducing image quality. (Only supported when ImageMagick is used.)

See also $imageDriver

View source

Signature

public boolean $optimizeImageFilesize = true

$pageTrigger

Type
string

The string preceding a number which Craft will look for when determining if the current request is for a particular page in a paginated list of pages.

View source

Signature

public string $pageTrigger = 'p'

$pathParam

Type
string

The query string param that Craft will check when determining the request's path.

View source

Signature

public string $pathParam = 'p'

$phpMaxMemoryLimit

Type
string

The maximum amount of memory Craft will try to reserve during memory intensive operations such as zipping, unzipping and updating. Defaults to an empty string, which means it will use as much memory as it possibly can.

See http://php.net/manual/en/faq.using.php#faq.using.shorthandbytes for a list of acceptable values.

View source

Signature

public string $phpMaxMemoryLimit = ''

$phpSessionName

Type
string

The name of the PHP session cookie.

See also https://php.net/manual/en/function.session-name.php

View source

Signature

public string $phpSessionName = 'CraftSessionId'

$postCpLoginRedirect

Type
mixed
Access
Read-only

The path that users should be redirected to after logging in from the Control Panel.

This setting will also come into effect if the user visits the CP’s Login page (/admin/login) or the CP’s root URL (/admin) when they are already logged in.

See craft\helpers\ConfigHelper::localizedValue() for a list of supported value types.

See also getPostCpLoginRedirect()

View source

Signature

public string getPostCpLoginRedirect ( )

$postLoginRedirect

Type
mixed
Access
Read-only

The path that users should be redirected to after logging in from the front-end site.

This setting will also come into effect if the user visits the Login page (as specified by the loginPath config setting) when they are already logged in.

See craft\helpers\ConfigHelper::localizedValue() for a list of supported value types.

See also getPostLoginRedirect()

View source

Signature

public string getPostLoginRedirect ( \craft\config\string $siteHandle = null )

$postLogoutRedirect

Type
mixed
Access
Read-only

The path that users should be redirected to after logging out from the front-end site.

See craft\helpers\ConfigHelper::localizedValue() for a list of supported value types.

See also getPostLogoutRedirect()

View source

Signature

public string getPostLogoutRedirect ( \craft\config\string $siteHandle = null )

$preserveCmykColorspace

Type
boolean

Whether CMYK should be preserved as the colorspace when when manipulating images.

Setting this to true will prevent Craft from transforming CMYK images to sRGB, but on some ImageMagick versions can cause color distortion in the image. This will only have effect if ImageMagick is in use.

View source

Signature

public boolean $preserveCmykColorspace = false

$preserveExifData

Type
boolean

Whether the EXIF data should be preserved when manipulating images.

Setting this to true will result in larger image file sizes.

This will only have effect if ImageMagick is in use.

View source

Signature

public boolean $preserveExifData = false

$preserveImageColorProfiles

Type
boolean

Whether the embedded Image Color Profile (ICC) should be preserved when manipulating images.

Setting this to false will reduce the image size a little bit, but on some ImageMagick versions can cause images to be saved with an incorrect gamma value, which causes the images to become very dark. This will only have effect if ImageMagick is in use.

View source

Signature

public boolean $preserveImageColorProfiles = true

$preventUserEnumeration

Type
boolean

When set to false and you go through the "forgot password" workflow on the Control Panel login page, for example, you get distinct messages saying if the username/email didn't exist or the email was successfully sent and to check your email for further instructions. This can allow for username/email enumeration based on the response. If set true, you will always get a successful response even if there was an error making it difficult to enumerate users.

View source

Signature

public boolean $preventUserEnumeration = false

$privateTemplateTrigger

Type
string

The template path segment prefix that should be used to identify "private" templates (templates that aren't directly accessible via a matching URL).

Set to an empty value to disable public template routing.

View source

Signature

public string $privateTemplateTrigger = '_'

$purgePendingUsersDuration

Type
mixed

The amount of time to wait before Craft purges pending users from the system that have not activated.

Note that any content assigned to a pending user will be deleted as well when the given time interval passes.

Set to 0 to disable this feature.

See craft\helpers\ConfigHelper::durationInSeconds() for a list of supported value types.

View source

Signature

public mixed $purgePendingUsersDuration = 0

$rememberUsernameDuration

Type
mixed

The amount of time Craft will remember a username and pre-populate it on the CP login page.

Set to 0 to disable this feature altogether.

See craft\helpers\ConfigHelper::durationInSeconds() for a list of supported value types.

View source

Signature

public mixed $rememberUsernameDuration = 31536000

$rememberedUserSessionDuration

Type
mixed

The amount of time a user stays logged if “Remember Me” is checked on the login page.

Set to 0 to disable the “Remember Me” feature altogether.

See craft\helpers\ConfigHelper::durationInSeconds() for a list of supported value types.

View source

Signature

public mixed $rememberedUserSessionDuration = 1209600

$requireMatchingUserAgentForSession

Type
boolean

Whether Craft should require a matching user agent string when restoring a user session from a cookie.

View source

Signature

public boolean $requireMatchingUserAgentForSession = true

$requireUserAgentAndIpForSession

Type
boolean

Whether Craft should require the existence of a user agent string and IP address when creating a new user session.

View source

Signature

public boolean $requireUserAgentAndIpForSession = true

$resourceBasePath

Type
string

The path to the root directory that should store published CP resources.

View source

Signature

public string $resourceBasePath = '@webroot/cpresources'

$resourceBaseUrl

Type
string

The URL to the root directory that should store published CP resources.

View source

Signature

public string $resourceBaseUrl = '@web/cpresources'

$restoreCommand

Type
string, null

The shell command that Craft should execute to restore a database backup.

By default Craft will run mysql or psql, provided that those libraries are in the $PATH variable for the user the web server is running as.

There are several tokens you can use that Craft will swap out at runtime:

  • {path} - the backup file path
  • {port} - the current database port
  • {server} - the current database host name
  • {user} - the user to connect to the database
  • {database} - the current database name
  • {schema} - the current database schema (if any)

This can also be set to false to disable database restores completely.

View source

Signature

public string, null $restoreCommand = null

$rotateImagesOnUploadByExifData

Type
boolean

Whether Craft should rotate images according to their EXIF data on upload.

View source

Signature

public boolean $rotateImagesOnUploadByExifData = true

$runQueueAutomatically

Type
boolean

Whether Craft should run pending queue jobs automatically over HTTP requests.

This setting should be disabled for servers running Win32, or with Apache’s mod_deflate/mod_gzip installed, where PHP’s flush() method won’t work.

If disabled, an alternate queue runner must be set up separately.

Here is an example of how you would setup a queue runner from a cron job that ran every minute:

/1 * * * * /path/to/project/root/craft queue/run

View source

Signature

public boolean $runQueueAutomatically = true

$sanitizeSvgUploads

Type
boolean

Whether Craft should sanitize uploaded SVG files and strip out potential malicious looking content.

This should definitely be enabled if you are accepting SVG uploads from untrusted sources.

View source

Signature

public boolean $sanitizeSvgUploads = true

$secureHeaders

Type
array, null

Lists of headers that are, by default, subject to the trusted host configuration.

See yii\web\Request::$secureHeaders for more details.

If not set, the default yii\web\Request::$secureHeaders value will be used.

View source

Signature

public array, null $secureHeaders = null

$secureProtocolHeaders

Type
array, null

List of headers to check for determining whether the connection is made via HTTPS.

See yii\web\Request::$secureProtocolHeaders for more details.

If not set, the default yii\web\Request::$secureProtocolHeaders value will be used.

View source

Signature

public array, null $secureProtocolHeaders = null

$securityKey

Type
string

A private, random, cryptographically-secure key that is used for hashing and encrypting data in craft\services\Security.

This value should be the same across all environments. Note that if this key ever changes, any data that was encrypted with it will be inaccessible.

View source

Signature

public string $securityKey = null

$sendPoweredByHeader

Type
boolean

Whether an X-Powered-By: Craft CMS header should be sent, helping services like BuiltWith and Wappalyzer identify that the site is running on Craft.

View source

Signature

public boolean $sendPoweredByHeader = true

$setPasswordPath

Type
mixed
Access
Read-only

The password-reset template path. Note that this only affects front-end site requests.

See craft\helpers\ConfigHelper::localizedValue() for a list of supported value types.

See also getSetPasswordPath()

View source

Signature

public string getSetPasswordPath ( \craft\config\string $siteHandle = null )

$setPasswordSuccessPath

Type
mixed
Access
Read-only

The URI Craft should redirect users to after setting their password from the front-end.

See craft\helpers\ConfigHelper::localizedValue() for a list of supported value types.

See also getSetPasswordSuccessPath()

View source

Signature

public string getSetPasswordSuccessPath ( \craft\config\string $siteHandle = null )

$siteName

Type
string, string[]

The site name(s). If set, it will take precedence over the Name settings in Settings → Sites → [Site Name].

This can be set to a string, which will override the primary site’s name only, or an array with site handles used as the keys.

View source

Signature

public string, string[] $siteName = null

$siteUrl

Type
string, string[]

The base URL to the site(s). If set, it will take precedence over the Base URL settings in Settings → Sites → [Site Name].

This can be set to a string, which will override the primary site’s base URL only, or an array with site handles used as the keys.

The URL(s) must begin with either http://, https://, // (protocol-relative), or an alias.

'siteUrl' => [
    'siteA' => 'https://site-a.com/',
    'siteB' => 'https://site-b.com/',
],

View source

Signature

public string, string[] $siteUrl = null

$slugWordSeparator

Type
string

The character(s) that should be used to separate words in slugs.

View source

Signature

public string $slugWordSeparator = '-'

$suppressTemplateErrors

Type
boolean

Whether Twig runtime errors should be suppressed.

If it is set to true, the errors will still be logged to Craft’s log files.

View source

Signature

public boolean $suppressTemplateErrors = false

$testToEmailAddress

Type
string, array, null

Configures Craft to send all system emails to a single email address, or an array of email addresses for testing purposes.

By default the recipient name(s) will be “Test Recipient”, but you can customize that by setting the value with the format ['email@address.com' => 'Name'].

View source

Signature

public string, array, null $testToEmailAddress = null

$timezone

Type
string, null

The timezone of the site. If set, it will take precedence over the Timezone setting in Settings → General.

This can be set to one of PHP’s supported timezones.

View source

Signature

public string, null $timezone = null

$tokenParam

Type
string

The query string parameter name that tokens should be set to.

View source

Signature

public string $tokenParam = 'token'

$transformGifs

Type
boolean

Whether GIF files should be cleansed/transformed.

View source

Signature

public boolean $transformGifs = true

$translationDebugOutput

Type
boolean

Whether translated messages should be wrapped in special characters, to help find any strings that are not being run through Craft::t() or the |translate filter.

View source

Signature

public boolean $translationDebugOutput = false

$trustedHosts

Type
array

The configuration for trusted security-related headers.

See yii\web\Request::$trustedHosts for more details.

By default, all hosts are trusted.

View source

Signature

public array $trustedHosts = ['any']

$useCompressedJs

Type
boolean

Whether Craft should use compressed JavaScript files whenever possible.

View source

Signature

public boolean $useCompressedJs = true

$useEmailAsUsername

Type
boolean

Whether Craft should set users’ usernames to their email addresses, rather than let them set their username separately.

View source

Signature

public boolean $useEmailAsUsername = false

$useFileLocks

Type
boolean, null

Whether to grab an exclusive lock on a file when writing to it by using the LOCK_EX flag.

Some file systems, such as NFS, do not support exclusive file locking.

If not set to true or false, Craft will automatically try to detect if the underlying file system supports exclusive file locking and cache the results.

See also http://php.net/manual/en/function.file-put-contents.php

View source

Signature

public boolean, null $useFileLocks = null

$usePathInfo

Type
boolean

Whether Craft should specify the path using PATH_INFO or as a query string parameter when generating URLs.

Note that this setting only takes effect if $omitScriptNameInUrls is set to false.

View source

Signature

public boolean $usePathInfo = false

$useSecureCookies

Type
boolean, string

Whether Craft will set the "secure" flag when saving cookies when using Craft::cookieConfig() to create a cookie.

Valid values are true, false, and 'auto'. Defaults to 'auto', which will set the secure flag if the page you're currently accessing is over https://. true will always set the flag, regardless of protocol and false will never automatically set the flag.

View source

Signature

public boolean, string $useSecureCookies = 'auto'

$useSslOnTokenizedUrls

Type
boolean, string

Determines what protocol/schema Craft will use when generating tokenized URLs. If set to 'auto', Craft will check the siteUrl and the protocol of the current request and if either of them are https will use https in the tokenized URL. If not, will use http.

If set to false, the Craft will always use http. If set to true, then, Craft will always use https.

View source

Signature

public boolean, string $useSslOnTokenizedUrls = 'auto'

$userSessionDuration

Type
mixed

The amount of time before a user will get logged out due to inactivity.

Set to 0 if you want users to stay logged in as long as their browser is open rather than a predetermined amount of time.

See craft\helpers\ConfigHelper::durationInSeconds() for a list of supported value types.

View source

Signature

public mixed $userSessionDuration = 3600

$verificationCodeDuration

Type
mixed

The amount of time a user verification code can be used before expiring.

See craft\helpers\ConfigHelper::durationInSeconds() for a list of supported value types.

View source

Signature

public mixed $verificationCodeDuration = 86400

Public Methods

MethodDescription
__call()Calls the named method which is not a class method.
__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.
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.
getActivateAccountSuccessPath()Returns the localized Activate Account Success Path value.
getBackupOnUpdate()Returns whether the DB should be backed up before running new migrations.
getInvalidUserTokenPath()Returns the localized Invalid User Token Path value.
getLoginPath()Returns the localized Login Path value.
getLogoutPath()Returns the localized Logout Path value.
getPostCpLoginRedirect()Returns the localized Post-CP Login Redirect path.
getPostLoginRedirect()Returns the localized Post-Login Redirect path.
getPostLogoutRedirect()Returns the localized Post-Logout Redirect path.
getSetPasswordPath()Returns the localized Set Password Path value.
getSetPasswordSuccessPath()Returns the localized Set Password Success Path value.
hasMethod()Returns a value indicating whether a method is defined.
hasProperty()Returns a value indicating whether a property is defined.
init()Initializes the object.

__construct()

Constructor.

The default implementation does two things:

  • Initializes the object with the given configuration $config.
  • Call init().

If this method is overridden in a child class, it is recommended that

  • the last parameter of the constructor is a configuration array, like $config here.
  • call the parent implementation at the end of the constructor.

View source

Arguments

  • $config (array) – Name-value pairs that will be used to initialize the object properties

Signature

public void __construct ( array $config = [] )

__get()

Returns the value of an object property.

Do not call this method directly as it is a PHP magic method that will be implicitly called when executing $value = $object->property;.

View source

Arguments

  • $name (string) – The property name

Returns

mixed – The property value

Throws

Signature

public mixed __get ( $name )

__isset()

Checks if a property is set, i.e. defined and not null.

Do not call this method directly as it is a PHP magic method that will be implicitly called when executing isset($object->property).

Note that if the property is not defined, false will be returned.

View source

Arguments

  • $name (string) – The property name or the event name

Returns

boolean – Whether the named property is set (not null).

Signature

public boolean __isset ( $name )

__set()

Sets value of an object property.

Do not call this method directly as it is a PHP magic method that will be implicitly called when executing $object->property = $value;.

View source

Arguments

  • $name (string) – The property name or the event name
  • $value (mixed) – The property value

Throws

Signature

public void __set ( $name, $value )

getActivateAccountSuccessPath()

Returns the localized Activate Account Success Path value.

See also $activateAccountSuccessPathView source

Arguments

  • $siteHandle (string, null) – The site handle the value should be defined for. Defaults to the current site.

Returns

string

Signature

public string getActivateAccountSuccessPath ( \craft\config\string $siteHandle = null )

getBackupOnUpdate()

Returns whether the DB should be backed up before running new migrations.

View source

Returns

boolean

Signature

public boolean getBackupOnUpdate ( )

getInvalidUserTokenPath()

Returns the localized Invalid User Token Path value.

See also $invalidUserTokenPathView source

Arguments

  • $siteHandle (string, null) – The site handle the value should be defined for. Defaults to the current site.

Returns

string

Signature

public string getInvalidUserTokenPath ( \craft\config\string $siteHandle = null )

getLoginPath()

Returns the localized Login Path value.

See also $loginPathView source

Arguments

  • $siteHandle (string, null) – The site handle the value should be defined for. Defaults to the current site.

Returns

string

Signature

public string getLoginPath ( \craft\config\string $siteHandle = null )

getLogoutPath()

Returns the localized Logout Path value.

See also $logoutPathView source

Arguments

  • $siteHandle (string, null) – The site handle the value should be defined for. Defaults to the current site.

Returns

string

Signature

public string getLogoutPath ( \craft\config\string $siteHandle = null )

getPostCpLoginRedirect()

Returns the localized Post-CP Login Redirect path.

See also $postCpLoginRedirectView source

Returns

string

Signature

public string getPostCpLoginRedirect ( )

getPostLoginRedirect()

Returns the localized Post-Login Redirect path.

See also $postLoginRedirectView source

Arguments

  • $siteHandle (string, null) – The site handle the value should be defined for. Defaults to the current site.

Returns

string

Signature

public string getPostLoginRedirect ( \craft\config\string $siteHandle = null )

getPostLogoutRedirect()

Returns the localized Post-Logout Redirect path.

See also $postLogoutRedirectView source

Arguments

  • $siteHandle (string, null) – The site handle the value should be defined for. Defaults to the current site.

Returns

string

Signature

public string getPostLogoutRedirect ( \craft\config\string $siteHandle = null )

getSetPasswordPath()

Returns the localized Set Password Path value.

See also $setPasswordPathView source

Arguments

  • $siteHandle (string, null) – The site handle the value should be defined for. Defaults to the current site.

Returns

string

Signature

public string getSetPasswordPath ( \craft\config\string $siteHandle = null )

getSetPasswordSuccessPath()

Returns the localized Set Password Success Path value.

See also $setPasswordSuccessPathView source

Arguments

  • $siteHandle (string, null) – The site handle the value should be defined for. Defaults to the current site.

Returns

string

Signature

public string getSetPasswordSuccessPath ( \craft\config\string $siteHandle = null )

init()

Initializes the object.

This method is invoked at the end of the constructor after the object is initialized with the given configuration.

View source

Signature

public void init ( )

Constants

ConstantDescription
IMAGE_DRIVER_AUTO
IMAGE_DRIVER_GD
IMAGE_DRIVER_IMAGICK