UrlSigner
in package
Creates signed URLs for Amazon CloudFront resources.
Table of Contents
Methods
- __construct() : mixed
- getSignedUrl() : string
- Create a signed Amazon CloudFront URL.
Methods
__construct()
public
__construct(string $keyPairId, string $privateKey[, int|string $algorithm = Signer::DEFAULT_ALGORITHM ]) : mixed
Parameters
- $keyPairId : string
-
ID of the key pair.
- $privateKey : string
-
Path to the private key used for signing, or a PEM-encoded key string.
- $algorithm : int|string = Signer::DEFAULT_ALGORITHM
-
Signing hash algorithm. Accepts either an OpenSSL constant (OPENSSL_ALGO_SHA1, OPENSSL_ALGO_SHA256) or the canonical name string ("SHA1", "SHA256"). Defaults to SHA1.
Tags
getSignedUrl()
Create a signed Amazon CloudFront URL.
public
getSignedUrl(string $url[, string|int|null $expires = null ][, string $policy = null ]) : string
Keep in mind that URLs meant for use in media/flash players may have different requirements for URL formats (e.g. some require that the extension be removed, some require the file name to be prefixed
- mp4:
, some require you to add "/cfx/st" into your URL).
Parameters
- $url : string
-
URL to sign (can include query string string and wildcards)
- $expires : string|int|null = null
-
UTC Unix timestamp used when signing with a canned policy. Not required when passing a custom $policy.
- $policy : string = null
-
JSON policy. Use this option when creating a signed URL for a custom policy.
Tags
Return values
string —The file URL with authentication parameters