class UrlConfig extends BaseConfigSection

Defines the global configuration applied when generating Cloudinary URLs.

Properties

bool $cdnSubdomain Whether to automatically build URLs with multiple CDN sub-domains.
bool $secureCdnSubdomain Secure CDN sub-domain.
string $cname The custom domain name to use for building HTTP URLs. Relevant only for Advanced plan users that have a private CDN distribution and a custom CNAME
string $secureCname The domain name of the CDN distribution to use for building HTTPS URLs. Relevant only for Advanced plan users that have a private CDN distribution.
bool $privateCdn Set this parameter to true if you are an Advanced plan user with a private CDN distribution.
bool $signUrl Set to true to create a Cloudinary URL signed with the first 8 characters of a SHA-1 hash.
bool $longUrlSignature Setting both this and signUrl to true will sign the URL using the first 32 characters of a SHA-256 hash.
bool $shorten Set to true to use shorten asset type.
bool $useRootPath Set to true to omit type and resource_type in the URL.
bool $responsiveWidth Whether to use responsive width.
bool $secure Force HTTPS URLs for resources even if they are embedded in non-secure HTTP pages.
bool $forceVersion By default set to self::DEFAULT_FORCE_VERSION.
string $responsiveWidthTransformation The transformation to use with responsive width.

Methods

cdnSubdomain(bool $cdnSubdomain = true)

Whether to automatically build URLs with multiple CDN sub-domains.

secureCdnSubdomain(bool $secureCdnSubdomain = true)

Whether to use secure CDN sub-domain.

cname(string $cname)

The custom domain name to use for building HTTP URLs.

secure(bool $secure = true)

Force HTTPS URLs for resources even if they are embedded in non-secure HTTP pages.

secureCname(string $secureCname)

The domain name of the CDN distribution to use for building HTTPS URLs.

privateCdn(bool $privateCdn = true)

Set this parameter to true if you are an Advanced plan user with a private CDN distribution.

signUrl(bool $signUrl = true)

Set to true to create a signed Cloudinary URL.

longUrlSignature(bool $longUrlSignature = true)

Setting both this and signUrl to true will sign the URL using the first 32 characters of a SHA-256 hash.

shorten(bool $shorten = true)

Set to true to use shorten asset type.

useRootPath(bool $useRootPath = true)

Set to true to omit type and resource_type in the URL.

forceVersion(bool $forceVersion = true)

Set to false to omit default version string for assets in folders in the delivery URL.

analytics(bool $analytics = true)

Set to false to omit analytics.

__toString()

Serialises configuration section to a string representation.

Details

$this cdnSubdomain(bool $cdnSubdomain = true)

Whether to automatically build URLs with multiple CDN sub-domains.

Parameters

Name Type Description
$cdnSubdomain bool

Return Value

$this

See also

https://cloudinary.com/documentation/advanced_url_delivery_options#multiple_sub_domains

$this secureCdnSubdomain(bool $secureCdnSubdomain = true)

Whether to use secure CDN sub-domain.

Parameters

Name Type Description
$secureCdnSubdomain bool

Return Value

$this

$this cname(string $cname)

The custom domain name to use for building HTTP URLs.

Relevant only for Advanced plan users that have a private CDN distribution and a custom CNAME.

Parameters

Name Type Description
$cname string

Return Value

$this

See also

https://cloudinary.com/documentation/advanced_url_delivery_options#private_cdns_and_cnames

$this secure(bool $secure = true)

Force HTTPS URLs for resources even if they are embedded in non-secure HTTP pages.

Parameters

Name Type Description
$secure bool

Return Value

$this

$this secureCname(string $secureCname)

The domain name of the CDN distribution to use for building HTTPS URLs.

Relevant only for Advanced plan users that have a private CDN distribution.

Parameters

Name Type Description
$secureCname string The CNAME for secure (https) URLs.

Return Value

$this

See also

https://cloudinary.com/documentation/advanced_url_delivery_options#private_cdns_and_cnames

$this privateCdn(bool $privateCdn = true)

Set this parameter to true if you are an Advanced plan user with a private CDN distribution.

Parameters

Name Type Description
$privateCdn bool

Return Value

$this

See also

https://cloudinary.com/documentation/advanced_url_delivery_options#private_cdns_and_cnames

$this signUrl(bool $signUrl = true)

Set to true to create a signed Cloudinary URL.

Parameters

Name Type Description
$signUrl bool

Return Value

$this

$this longUrlSignature(bool $longUrlSignature = true)

Setting both this and signUrl to true will sign the URL using the first 32 characters of a SHA-256 hash.

Parameters

Name Type Description
$longUrlSignature bool

Return Value

$this

See also

https://cloudinary.com/documentation/advanced_url_delivery_options#generating_delivery_url_signatures

$this shorten(bool $shorten = true)

Set to true to use shorten asset type.

Parameters

Name Type Description
$shorten bool

Return Value

$this

$this useRootPath(bool $useRootPath = true)

Set to true to omit type and resource_type in the URL.

Parameters

Name Type Description
$useRootPath bool

Return Value

$this

See also

https://cloudinary.com/documentation/advanced_url_delivery_options#root_path_urls

$this forceVersion(bool $forceVersion = true)

Set to false to omit default version string for assets in folders in the delivery URL.

Parameters

Name Type Description
$forceVersion bool

Return Value

$this

$this analytics(bool $analytics = true)

Set to false to omit analytics.

Parameters

Name Type Description
$analytics bool Whether to include analytics.

Return Value

$this

string __toString()

Serialises configuration section to a string representation.

Return Value

string

Constants

CONFIG_NAME

DEFAULT_DOMAIN

DEFAULT_SUB_DOMAIN

DEFAULT_SHARED_HOST

PROTOCOL_HTTP

PROTOCOL_HTTPS

DEFAULT_SECURE

Default value for secure (distribution).

DEFAULT_FORCE_VERSION

Default value for forcing version.

DEFAULT_ANALYTICS

Default value for analytics.

DEFAULT_RESPONSIVE_WIDTH_TRANSFORMATION

Default responsive width transformation.

CDN_SUBDOMAIN

SECURE_CDN_SUBDOMAIN

CNAME

SECURE

SECURE_CNAME

PRIVATE_CDN

SIGN_URL

LONG_URL_SIGNATURE

SHORTEN

USE_ROOT_PATH

FORCE_VERSION

ANALYTICS

RESPONSIVE_WIDTH

RESPONSIVE_WIDTH_TRANSFORMATION