Documentation

UrlSigner
in package

Creates signed URLs for Amazon CloudFront resources.

Table of Contents

$signer  : mixed
__construct()  : mixed
getSignedUrl()  : string
Create a signed Amazon CloudFront URL.
createResource()  : string
createRtmpUrl()  : mixed

Properties

Methods

__construct()

public __construct( $keyPairId,  $privateKey) : mixed
Parameters
$keyPairId :

string ID of the key pair

$privateKey :

string Path to the private key used for signing

Tags
throws
RuntimeException

if the openssl extension is missing

throws
InvalidArgumentException

if the private key cannot be found.

Return values
mixed

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
throws
InvalidArgumentException

if the URL provided is invalid

link
http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/WorkingWithStreamingDistributions.html
Return values
string

The file URL with authentication parameters

createResource()

private createResource( $scheme,  $url) : string
Parameters
$scheme :
$url :
Return values
string

Search results