Skip to content

GeneralConfig

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

General config class

View source

Public Properties

PropertyDescription
accessibilityDefaultsarray – The default user accessibility preferences that should be applied to users that haven’t saved their preferences yet.
actionTriggerstring – The URI segment Craft should look for when determining if the current request should 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 that should be defined for every request.
allowAdminChangesboolean – Whether admins should be allowed to make administrative changes to the system.
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.
allowedGraphqlOriginsstring[], false, null – The Ajax origins that should be allowed to access the GraphQL API, if enabled.
autoLoginAfterAccountActivationboolean – Whether users should automatically be logged in after activating their account or resetting their password.
autosaveDraftsboolean – Whether drafts should be saved automatically as they are edited.
backupCommandstring, false, 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 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.
brokenImagePathstring, null – The server path to an image file that should be sent when responding to an image request with a 404 status code.
cacheDurationmixed – The default length of time Craft will store data, RSS feed, and template caches.
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.
cpHeadTagsarray – List of additional HTML tags that should be included in the <head> of control panel pages.
cpTriggerstring, null – 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 config3: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.
defaultCpLocalestring, null – The default locale the control panel should use for date/number formatting, for users who haven’t set a preferred language or formatting locale.
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 new users should have set as their Week Start Day.
deferPublicRegistrationPasswordboolean – By default, Craft requires a front-end “password” field for public user registrations.
devModeboolean – Whether the system should run in Dev Mode.
disableGraphqlTransformDirectiveboolean – Whether the transform directive should be disabled for the GraphQL API.
disabledPluginsstring[], string, null – Array of plugin handles that should be disabled, regardless of what the project config says.
disallowRobotsboolean – Whether front end requests should respond with X-Robots-Tag: none HTTP headers, indicating that pages should not be indexed, and links on the page should not be followed, by web crawlers.
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).
enableBasicHttpAuthboolean – Whether front-end web requests should support basic HTTP authentication.
enableCsrfCookieboolean – Whether to use a cookie to persist the CSRF token if config3:enableCsrfProtection is enabled.
enableCsrfProtectionboolean – Whether to enable CSRF protection via hidden form inputs for all forms submitted via Craft.
enableGqlboolean – Whether the GraphQL API should be enabled.
enableGraphqlCachingboolean – Whether Craft should cache GraphQL queries.
enableGraphqlIntrospectionboolean – Whether GraphQL introspection queries are allowed.
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 config3: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.
extraFileKindsarray – List of additional file kinds Craft should support.
filenameWordSeparatorstring, boolean – The string to use to separate words when uploading assets.
generateTransformsBeforePageLoadboolean – Whether image transforms should be generated before page load.
gqlTypePrefixstring – Prefix to use for all type names returned by GraphQL.
handleCasingstring – The casing to use for autogenerated component handles.
headlessModeboolean – Whether the system should run in Headless Mode, which optimizes the system and control panel for headless CMS implementations.
httpProxystring, null – The proxy server that should be used for outgoing HTTP requests.
imageDrivermixed – The image driver Craft should use to cleanse and transform images.
imageEditorRatiosarray – An array containing the selectable image aspect ratios for the image editor.
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.
isSystemLiveboolean, null – Whether the site is currently live.
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.
maxBackupsinteger, false – The number of backups Craft should make before it starts deleting the oldest backups.
maxCachedCloudImageSizeinteger – The maximum dimension size to use when caching images from external sources to use in transforms.
maxGraphqlBatchSizeinteger – The maximum allowed GraphQL queries that can be executed in a single batched request.
maxGraphqlComplexityinteger – The maximum allowed complexity a GraphQL query is allowed to have.
maxGraphqlDepthinteger – The maximum allowed depth a GraphQL query is allowed to reach.
maxGraphqlResultsinteger – The maximum allowed results for a single GraphQL query.
maxInvalidLoginsinteger – The number of invalid login attempts Craft will allow within the specified duration before the account gets locked.
maxRevisionsinteger, null – The maximum number of revisions that should be stored for each element.
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.php (e.g. http://my-project.tld/path instead of http://my-project.tld/index.php/path)
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, null – The query string param that Craft will check when determining the request’s path.
permissionsPolicyHeaderstring, null – The Permissions-Policy header that should be sent for web responses.
phpMaxMemoryLimitstring, null – 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 users should be redirected to after logging into the control panel.
postLoginRedirectmixed – The path 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.
prefixGqlRootTypesboolean – Whether the config3:gqlTypePrefix config setting should have an impact on query, mutation, and subscription types.
preserveCmykColorspaceboolean – Whether CMYK should be preserved as the colorspace when manipulating images.
preserveExifDataboolean – Whether the EXIF data should be preserved when manipulating and uploading images.
preserveImageColorProfilesboolean – Whether the embedded Image Color Profile (ICC) should be preserved when manipulating images.
preventUserEnumerationboolean – When true, Craft will always return a successful response in the “forgot password” flow, making it difficult to enumerate users.
previewIframeResizerOptionsarray – Custom iFrame Resizer options that should be used for preview iframes.
previewTokenDurationmixed – The amount of time content preview tokens can be used before expiring.
privateTemplateTriggerstring – The template path segment prefix that should be used to identify “private” templates, which are templates that are not 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.
purgeStaleUserSessionDurationmixed – The amount of time to wait before Craft purges stale user sessions from the sessions table in the database.
purgeUnsavedDraftsDurationmixed – The amount of time to wait before Craft purges unpublished drafts that were never updated with content.
rasterizeSvgThumbsboolean – Whether SVG thumbnails should be rasterized.
rememberUsernameDurationmixed – The amount of time Craft will remember a username and pre-populate it on the control panel’s 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 control panel resources.
resourceBaseUrlstring – The URL to the root directory that should store published control panel resources.
restoreCommandstring, null – The shell command Craft should execute to restore a database backup.
revAssetUrlsboolean – Whether asset URLs should be revved so browsers don’t load cached versions when they’re modified.
rotateImagesOnUploadByExifDataboolean – Whether Craft should rotate images according to their EXIF data on upload.
runQueueAutomaticallyboolean – Whether Craft should run pending queue jobs automatically when someone visits the control panel.
sameSiteCookieValuestring – The SameSite value that should be set on Craft cookies, if any.
sanitizeCpImageUploadsboolean – Whether images uploaded via the control panel should be sanitized.
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.
sendContentLengthHeaderboolean – Whether a Content-Length header should be sent with responses.
sendPoweredByHeaderboolean – 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.
setGraphqlDatesToSystemTimeZoneboolean – Whether dates returned by the GraphQL API should be set to the system time zone by default, rather than UTC.
setPasswordPathmixed – The URI or URL that Craft should use for Set Password forms on the front end.
setPasswordRequestPathmixed – The URI to the page where users can request to change their password.
setPasswordSuccessPathmixed – The URI Craft should redirect users to after setting their password from the front end.
siteNamestring, string[] – The site name(s).
siteTokenstring – The query string parameter name that site tokens should be set to.
siteUrlstring, string[] – The base URL to the site(s).
slugWordSeparatorstring – The character(s) that should be used to separate words in slugs.
softDeleteDurationmixed – The amount of time before a soft-deleted item will be up for hard-deletion by garbage collection.
storeUserIpsboolean – Whether user IP addresses should be stored/logged by the system.
suppressTemplateErrorsboolean – Whether Twig runtime errors should be suppressed.
testToEmailAddressstring, array, false, null – Configures Craft to send all system emails to either 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 Craft tokens should be set to.
transformGifsboolean – Whether GIF files should be cleansed/transformed.
transformSvgsboolean – Whether SVG files should be 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 `
trustedHostsarray – The configuration for trusted security-related headers.
upscaleImagesboolean – Whether images should be upscaled if the provided transform size is larger than the image.
useCompressedJsboolean – Whether Craft should include minified JavaScript files whenever possible, and minify JavaScript code passed to \craft\web\View::includeJs() or {% js %} Twig tags.
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.
useIframeResizerboolean – Whether iFrame Resizer options should be used for Live Preview.
usePathInfoboolean – Whether Craft should specify the path using PATH_INFO or as a query string parameter when generating URLs.
useProjectConfigFileboolean – Whether the project config should be saved to the config/ folder.
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.
verifyEmailPathmixed – The URI or URL that Craft should use for email verification links on the front end.
verifyEmailSuccessPathmixed – The URI that users without access to the control panel should be redirected to after verifying a new email address.

accessibilityDefaults

Type
array
Default value
[ 'alwaysShowFocusRings' => false, 'useShapes' => false, 'underlineLinks' => false, ]
Since
3.6.4

The default user accessibility preferences that should be applied to users that haven’t saved their preferences yet.

View source

actionTrigger

Type
string
Default value
'actions'

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

View source

activateAccountSuccessPath

Type
mixed
Default value
''

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

See also getActivateAccountSuccessPath()

View source

addTrailingSlashesToUrls

Type
boolean
Default value
false

Whether auto-generated URLs should have trailing slashes.

View source

aliases

Type
array
Default value
[]

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

View source

allowAdminChanges

Type
boolean
Default value
true
Since
3.1.0

Whether admins should be allowed to make administrative changes to the system.

View source

allowSimilarTags

Type
boolean
Default value
false

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

View source

allowUpdates

Type
boolean
Default value
true

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

View source

allowUppercaseInSlug

Type
boolean
Default value
false

Whether uppercase letters should be allowed in slugs.

View source

allowedFileExtensions

Type
string[]
Default value
[ '7z', 'aiff', 'asc', 'asf', 'avi', 'avif', 'bmp', 'cap', 'cin', 'csv', 'dfxp', 'doc', 'docx', 'dotm', 'dotx', 'fla', 'flv', 'gif', 'gz', 'gzip', 'heic', 'heif', 'hevc', 'itt', 'jp2', 'jpeg', 'jpg', 'jpx', 'js', 'json', 'lrc', 'm2t', 'm4a', 'm4v', 'mcc', 'mid', 'mov', 'mp3', 'mp4', 'mpc', 'mpeg', 'mpg', 'mpsub', 'ods', 'odt', 'ogg', 'ogv', 'pdf', 'png', 'potx', 'pps', 'ppsm', 'ppsx', 'ppt', 'pptm', 'pptx', 'ppz', 'pxd', 'qt', 'ram', 'rar', 'rm', 'rmi', 'rmvb', 'rt', 'rtf', 'sami', 'sbv', 'scc', 'sdc', 'sitd', 'smi', 'srt', 'stl', 'sub', 'svg', 'swf', 'sxc', 'sxw', 'tar', 'tds', 'tgz', 'tif', 'tiff', 'ttml', 'txt', 'vob', 'vsd', 'vtt', 'wav', 'webm', 'webp', 'wma', 'wmv', 'xls', 'xlsx', 'zip', ]

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

See also extraAllowedFileExtensions

View source

allowedGraphqlOrigins

Type
string[], false, null
Default value
null
Since
3.5.0

The Ajax origins that should be allowed to access the GraphQL API, if enabled.

View source

autoLoginAfterAccountActivation

Type
boolean
Default value
false

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

View source

autosaveDrafts

Type
boolean
Default value
true
Since
3.5.6

Whether drafts should be saved automatically as they are edited.

View source

backupCommand

Type
string, false, null
Default value
null

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

View source

backupOnUpdate

Type
boolean
Default value
true

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

See also backupCommand

View source

baseCpUrl

Type
string, null
Default value
null

The base URL Craft should use when generating control panel URLs.

View source

blowfishHashCost

Type
integer
Default value
13

The higher the cost value, the longer it takes to generate a password hash and to verify against it.

View source

brokenImagePath

Type
string, null
Default value
null
Since
3.5.0

The server path to an image file that should be sent when responding to an image request with a 404 status code.

View source

cacheDuration

Type
mixed
Default value
86400 (1 day)

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

View source

convertFilenamesToAscii

Type
boolean
Default value
false

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

View source

cooldownDuration

Type
mixed
Default value
300 (5 minutes)

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.

View source

cpHeadTags

Type
array
Default value
[]
Since
3.5.0

List of additional HTML tags that should be included in the <head> of control panel pages.

View source

cpTrigger

Type
string, null
Default value
'admin'

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

csrfTokenName

Type
string
Default value
'CRAFT_CSRF_TOKEN'

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

See also enableCsrfProtection

View source

customAsciiCharMappings

DEPRECATED

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

Type
array
Default value
[]

Any custom ASCII character mappings.

View source

defaultCookieDomain

Type
string
Default value
''

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 '.my-project.tld'.

View source

defaultCpLanguage

Type
string, null
Default value
null

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

View source

defaultCpLocale

Type
string, null
Default value
null
Since
3.5.0

The default locale the control panel should use for date/number formatting, for users who haven’t set a preferred language or formatting locale.

View source

defaultDirMode

Type
mixed
Default value
0775

The default permission to be set for newly-generated directories.

View source

defaultFileMode

Type
integer, null
Default value
null

The default permission to be set for newly-generated files.

View source

defaultImageQuality

Type
integer
Default value
82

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

View source

defaultSearchTermOptions

Type
array
Default value
[]

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

View source

defaultTemplateExtensions

Type
string[]
Default value
[ 'html', 'twig', ]

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

View source

defaultTokenDuration

Type
mixed
Default value
86400 (1 day)

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

View source

defaultWeekStartDay

Type
integer
Default value
1 (Monday)

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

View source

deferPublicRegistrationPassword

Type
boolean
Default value
false

By default, Craft requires a front-end “password” field for public user registrations. Setting this to true removes that requirement for the initial registration form.

View source

devMode

Type
boolean
Default value
false

Whether the system should run in Dev Mode.

View source

disableGraphqlTransformDirective

Type
boolean
Default value
false
Since
3.6.0

Whether the transform directive should be disabled for the GraphQL API.

View source

disabledPlugins

Type
string[], string, null
Default value
null
Since
3.1.9

Array of plugin handles that should be disabled, regardless of what the project config says.

View source

disallowRobots

Type
boolean
Default value
false
Since
3.5.10

Whether front end requests should respond with X-Robots-Tag: none HTTP headers, indicating that pages should not be indexed, and links on the page should not be followed, by web crawlers.

View source

elevatedSessionDuration

Type
mixed
Default value
300 (5 minutes)

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

View source

enableBasicHttpAuth

Type
boolean
Default value
false
Since
3.5.0

Whether front-end web requests should support basic HTTP authentication.

View source

enableCsrfCookie

Type
boolean
Default value
true

Whether to use a cookie to persist the CSRF token if config3: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 needed, which may degrade site performance.

See also enableCsrfProtection

View source

enableCsrfProtection

Type
boolean
Default value
true

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

See also:

View source

enableGql

Type
boolean
Default value
true
Since
3.3.1

Whether the GraphQL API should be enabled.

View source

enableGraphqlCaching

Type
boolean
Default value
true
Since
3.3.12

Whether Craft should cache GraphQL queries.

View source

enableGraphqlIntrospection

Type
boolean
Default value
true
Since
3.6.0

Whether GraphQL introspection queries are allowed. Defaults to true and is always allowed in the control panel.

View source

enableTemplateCaching

Type
boolean
Default value
true

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

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

View source

errorTemplatePrefix

Type
string
Default value
''

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

View source

extraAllowedFileExtensions

Type
string[], null
Default value
null

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

See also allowedFileExtensions

View source

extraAppLocales

Type
string[], null
Default value
null
Since
3.0.24

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

View source

extraFileKinds

Type
array
Default value
[]
Since
3.0.37

List of additional file kinds Craft should support. This array will get merged with the one defined in \craft\helpers\Assets::_buildFileKinds().

View source

filenameWordSeparator

Type
string, boolean
Default value
'-'

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

View source

generateTransformsBeforePageLoad

Type
boolean
Default value
false

Whether image transforms should be generated before page load.

View source

gqlTypePrefix

Type
string
Default value
''

Prefix to use for all type names returned by GraphQL.

View source

handleCasing

Type
string
Default value
self::CAMEL_CASE
Since
3.6.0

The casing to use for autogenerated component handles.

View source

headlessMode

Type
boolean
Default value
false
Since
3.3.0

Whether the system should run in Headless Mode, which optimizes the system and control panel for headless CMS implementations.

View source

httpProxy

Type
string, null
Default value
null
Since
3.7.0

The proxy server that should be used for outgoing HTTP requests.

View source

imageDriver

Type
mixed
Default value
self::IMAGE_DRIVER_AUTO

The image driver Craft should use to cleanse and transform images. By default Craft will use ImageMagick if it’s installed and otherwise fall back to GD. You can explicitly set either 'imagick' or 'gd' here to override that behavior.

View source

imageEditorRatios

Type
array
Default value
[ 'Unconstrained' => 'none', 'Original' => 'original', 'Square' => 1, '16:9' => 1.78, '10:8' => 1.25, '7:5' => 1.4, '4:3' => 1.33, '5:3' => 1.67, '3:2' => 1.5, ]

An array containing the selectable image aspect ratios for the image editor. The array must be in the format of label => ratio, where ratio must be a float or a string. For string values, only values of “none” and “original” are allowed.

View source

indexTemplateFilenames

Type
string[]
Default value
[ 'index', ]

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

invalidLoginWindowDuration

Type
mixed
Default value
3600 (1 hour)

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

View source

invalidUserTokenPath

Type
mixed
Default value
''

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 also getInvalidUserTokenPath()

View source

ipHeaders

Type
string[], null
Default value
null

List of headers where proxies store the real client IP.

View source

isSystemLive

Type
boolean, null
Default value
null

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

View source

limitAutoSlugsToAscii

Type
boolean
Default value
false

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

View source

loginPath

Type
mixed
Default value
'login'

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

See also getLoginPath()

View source

logoutPath

Type
mixed
Default value
'logout'

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

See also getLogoutPath()

View source

maxBackups

Type
integer, false
Default value
20

The number of backups Craft should make before it starts deleting the oldest backups. If set to false, Craft will not delete any backups.

View source

maxCachedCloudImageSize

Type
integer
Default value
2000

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

maxGraphqlBatchSize

Type
integer
Default value
0
Since
3.9.3

The maximum allowed GraphQL queries that can be executed in a single batched request. Set to 0 to allow any number of queries.

View source

maxGraphqlComplexity

Type
integer
Default value
0
Since
3.6.0

The maximum allowed complexity a GraphQL query is allowed to have. Set to 0 to allow any complexity.

View source

maxGraphqlDepth

Type
integer
Default value
0
Since
3.6.0

The maximum allowed depth a GraphQL query is allowed to reach. Set to 0 to allow any depth.

View source

maxGraphqlResults

Type
integer
Default value
0
Since
3.6.0

The maximum allowed results for a single GraphQL query. Set to 0 to disable any limits.

View source

maxInvalidLogins

Type
integer
Default value
5

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

View source

maxRevisions

Type
integer, null
Default value
50
Since
3.2.0

The maximum number of revisions that should be stored for each element.

View source

maxSlugIncrement

Type
integer
Default value
100

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

View source

maxUploadFileSize

Type
integer, string
Default value
16777216 (16MB)

The maximum upload file size allowed.

View source

omitScriptNameInUrls

Type
boolean
Default value
false

Whether generated URLs should omit index.php (e.g. http://my-project.tld/path instead of http://my-project.tld/index.php/path)

View source

optimizeImageFilesize

Type
boolean
Default value
true

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

pageTrigger

Type
string
Default value
'p'

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.

See also getPageTrigger()

View source

pathParam

Type
string, null
Default value
'p'

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

View source

permissionsPolicyHeader

Type
string, null
Default value
null
Since
3.6.14

The Permissions-Policy header that should be sent for web responses.

View source

phpMaxMemoryLimit

Type
string, null
Default value
null

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 can.

View source

phpSessionName

Type
string
Default value
'CraftSessionId'

The name of the PHP session cookie.

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

View source

postCpLoginRedirect

Type
mixed
Default value
'dashboard'

The path users should be redirected to after logging into the control panel.

See also getPostCpLoginRedirect()

View source

postLoginRedirect

Type
mixed
Default value
''

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

See also getPostLoginRedirect()

View source

postLogoutRedirect

Type
mixed
Default value
''

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

See also getPostLogoutRedirect()

View source

prefixGqlRootTypes

Type
boolean
Default value
true
Since
3.6.6

Whether the config3:gqlTypePrefix config setting should have an impact on query, mutation, and subscription types.

View source

preserveCmykColorspace

Type
boolean
Default value
false
Since
3.0.8

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

View source

preserveExifData

Type
boolean
Default value
false

Whether the EXIF data should be preserved when manipulating and uploading images.

View source

preserveImageColorProfiles

Type
boolean
Default value
true

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

View source

preventUserEnumeration

Type
boolean
Default value
false

When true, Craft will always return a successful response in the “forgot password” flow, making it difficult to enumerate users.

View source

previewIframeResizerOptions

Type
array
Default value
[]
Since
3.5.0

Custom iFrame Resizer options that should be used for preview iframes.

View source

previewTokenDuration

Type
mixed
Default value
null (1 day)
Since
3.7.0

The amount of time content preview tokens can be used before expiring.

View source

privateTemplateTrigger

Type
string
Default value
'_'

The template path segment prefix that should be used to identify “private” templates, which are templates that are not directly accessible via a matching URL.

View source

purgePendingUsersDuration

Type
mixed
Default value
0

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

View source

purgeStaleUserSessionDuration

Type
mixed
Default value
7776000 (90 days)
Since
3.3.0

The amount of time to wait before Craft purges stale user sessions from the sessions table in the database.

View source

purgeUnsavedDraftsDuration

Type
mixed
Default value
2592000 (30 days)
Since
3.2.0

The amount of time to wait before Craft purges unpublished drafts that were never updated with content.

View source

rasterizeSvgThumbs

Type
boolean
Default value
false
Since
3.6.0

Whether SVG thumbnails should be rasterized.

View source

rememberUsernameDuration

Type
mixed
Default value
31536000 (1 year)

The amount of time Craft will remember a username and pre-populate it on the control panel’s Login page.

View source

rememberedUserSessionDuration

Type
mixed
Default value
1209600 (14 days)

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

View source

requireMatchingUserAgentForSession

Type
boolean
Default value
true

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

View source

requireUserAgentAndIpForSession

Type
boolean
Default value
true

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

View source

resourceBasePath

Type
string
Default value
'@webroot/cpresources'

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

View source

resourceBaseUrl

Type
string
Default value
'@web/cpresources'

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

View source

restoreCommand

Type
string, null
Default value
null

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

View source

revAssetUrls

Type
boolean
Default value
false
Since
3.7.0

Whether asset URLs should be revved so browsers don’t load cached versions when they’re modified.

View source

rotateImagesOnUploadByExifData

Type
boolean
Default value
true

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

View source

runQueueAutomatically

Type
boolean
Default value
true

Whether Craft should run pending queue jobs automatically when someone visits the control panel.

View source

sameSiteCookieValue

Type
string
Default value
null
Since
3.1.33

The SameSite value that should be set on Craft cookies, if any.

View source

sanitizeCpImageUploads

Type
boolean
Default value
true
Since
3.6.0

Whether images uploaded via the control panel should be sanitized.

View source

sanitizeSvgUploads

Type
boolean
Default value
true

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

View source

secureHeaders

Type
array, null
Default value
null

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

View source

secureProtocolHeaders

Type
array, null
Default value
null

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

View source

securityKey

Type
string
Default value
null

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

View source

sendContentLengthHeader

Type
boolean
Default value
false
Since
3.7.3

Whether a Content-Length header should be sent with responses.

View source

sendPoweredByHeader

Type
boolean
Default value
true

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

setGraphqlDatesToSystemTimeZone

Type
boolean
Default value
false
Since
3.7.0

Whether dates returned by the GraphQL API should be set to the system time zone by default, rather than UTC.

View source

setPasswordPath

Type
mixed
Default value
'setpassword'

The URI or URL that Craft should use for Set Password forms on the front end.

See also getSetPasswordPath()

View source

setPasswordRequestPath

Type
mixed
Default value
null
Since
3.5.14

The URI to the page where users can request to change their password.

See also getSetPasswordRequestPath()

View source

setPasswordSuccessPath

Type
mixed
Default value
''

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

See also getSetPasswordSuccessPath()

View source

siteName

DEPRECATED

Deprecated in 3.6.0. Set your sites’ Name settings on a per-environment basis using environment variables instead. See Environmental Configuration for more info.

Type
string, string[]
Default value
null

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

View source

siteToken

Type
string
Default value
'siteToken'
Since
3.5.0

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

View source

siteUrl

DEPRECATED

Deprecated in 3.6.0. Set your sites’ Base URL settings on a per-environment basis using aliases or environment variables instead. See Environmental Configuration for more info.

Type
string, string[]
Default value
null

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

View source

slugWordSeparator

Type
string
Default value
'-'

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

View source

softDeleteDuration

Type
mixed
Default value
2592000 (30 days)
Since
3.1.0

The amount of time before a soft-deleted item will be up for hard-deletion by garbage collection.

View source

storeUserIps

Type
boolean
Default value
false
Since
3.1.0

Whether user IP addresses should be stored/logged by the system.

View source

suppressTemplateErrors

DEPRECATED

Deprecated in 3.3.0

Type
boolean
Default value
false

Whether Twig runtime errors should be suppressed.

View source

testToEmailAddress

Type
string, array, false, null
Default value
null

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

View source

timezone

Type
string, null
Default value
null

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

View source

tokenParam

Type
string
Default value
'token'

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

View source

transformGifs

Type
boolean
Default value
true
Since
3.0.7

Whether GIF files should be cleansed/transformed.

View source

transformSvgs

Type
boolean
Default value
true
Since
3.7.1

Whether SVG files should be transformed.

View source

translationDebugOutput

Type
boolean
Default value
false

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

trustedHosts

Type
array
Default value
[ 'any', ]

The configuration for trusted security-related headers.

View source

upscaleImages

Type
boolean
Default value
true
Since
3.4.0

Whether images should be upscaled if the provided transform size is larger than the image.

View source

useCompressedJs

DEPRECATED

Deprecated in 3.5.0

Type
boolean
Default value
true

Whether Craft should include minified JavaScript files whenever possible, and minify JavaScript code passed to \craft\web\View::includeJs() or {% js %} Twig tags.

View source

useEmailAsUsername

Type
boolean
Default value
false

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

View source

useFileLocks

Type
boolean, null
Default value
null

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

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

View source

useIframeResizer

Type
boolean
Default value
false
Since
3.5.5

Whether iFrame Resizer options should be used for Live Preview.

View source

usePathInfo

Type
boolean
Default value
false

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

View source

useProjectConfigFile

DEPRECATED

Deprecated in 3.5.0. Craft now always saves the project config out to the config/ folder.

Type
boolean
Default value
true
Since
3.1.0

Whether the project config should be saved to the config/ folder.

View source

useSecureCookies

Type
boolean, string
Default value
'auto'

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

View source

useSslOnTokenizedUrls

Type
boolean, string
Default value
'auto'

Determines what protocol/schema Craft will use when generating tokenized URLs. If set to 'auto', Craft will check the current site’s base URL 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.

View source

userSessionDuration

Type
mixed
Default value
3600 (1 hour)

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

View source

verificationCodeDuration

Type
mixed
Default value
86400 (1 day)

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

View source

verifyEmailPath

Type
mixed
Default value
'verifyemail'
Since
3.4.0

The URI or URL that Craft should use for email verification links on the front end.

See also getVerifyEmailPath()

View source

verifyEmailSuccessPath

Type
mixed
Default value
''
Since
3.1.20

The URI that users without access to the control panel should be redirected to after verifying a new email address.

See also getVerifyEmailSuccessPath()

View source

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.
getPageTrigger()Returns the normalized page trigger.
getPostCpLoginRedirect()Returns the localized Post-Login Redirect path for the control panel.
getPostLoginRedirect()Returns the localized Post-Login Redirect path.
getPostLogoutRedirect()Returns the localized Post-Logout Redirect path.
getSetPasswordPath()Returns the localized Set Password Path value.
getSetPasswordRequestPath()Returns the localized Set Password Request Path value.
getSetPasswordSuccessPath()Returns the localized Set Password Success Path value.
getTestToEmailAddress()Returns the normalized test email addresses.
getVerifyEmailPath()Returns the localized Verify Email Path value.
getVerifyEmailSuccessPath()Returns the localized Verify Email 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.

__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

__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).

__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

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

getBackupOnUpdate()

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

View source

Returns

boolean

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

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

mixed

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

mixed

getPageTrigger()

Since
3.2.0

Returns the normalized page trigger.

See also pageTriggerView source

Returns

string

getPostCpLoginRedirect()

Returns the localized Post-Login Redirect path for the control panel.

See also postCpLoginRedirectView source

Returns

string

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

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

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

getSetPasswordRequestPath()

Since
3.5.14

Returns the localized Set Password Request Path value.

See also setPasswordRequestPathView source

Arguments

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

Returns

string, 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

getTestToEmailAddress()

Since
3.5.0

Returns the normalized test email addresses.

View source

Returns

array

getVerifyEmailPath()

Since
3.4.0

Returns the localized Verify Email Path value.

See also verifyEmailPathView source

Arguments

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

Returns

string

getVerifyEmailSuccessPath()

Since
3.1.20

Returns the localized Verify Email Success Path value.

See also verifyEmailSuccessPathView source

Arguments

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

Returns

string

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

Constants

ConstantDescription
CAMEL_CASE
IMAGE_DRIVER_AUTO
IMAGE_DRIVER_GD
IMAGE_DRIVER_IMAGICK
PASCAL_CASE
SNAKE_CASE