PHP Class Spatie\UrlSigner\BaseUrlSigner

Inheritance: implements Spatie\UrlSigner\UrlSigner
Afficher le fichier Open project: spatie/url-signer

Protected Properties

Свойство Type Description
$expiresParameter string The URL's query parameter name for the expiration.
$signatureKey string The key that is used to generate secure signatures.
$signatureParameter string The URL's query parameter name for the signature.

Méthodes publiques

Méthode Description
__construct ( string $signatureKey, string $expiresParameter = 'expires', string $signatureParameter = 'signature' )
sign ( string $url, DateTime | integer $expiration ) : string Get a secure URL to a controller action.
validate ( string $url ) : boolean Validate a signed url.

Méthodes protégées

Méthode Description
getExpirationTimestamp ( DateTime | integer $expiration ) : string Retrieve the expiration timestamp for a link based on an absolute DateTime or a relative number of days.
getIntendedUrl ( League\Url\UrlImmutable $url ) : League\Url\UrlImmutable Retrieve the intended URL by stripping off the UrlSigner specific parameters.
hasValidSignature ( League\Url\UrlImmutable $url ) : boolean Determine if the url has a forged signature.
isFuture ( integer $timestamp ) : boolean Check if an a timestamp is in the past.
isMissingAQueryParameter ( League\Url\Components\QueryInterface $query ) : boolean Check if a query is missing a necessary parameter.
signUrl ( League\Url\UrlImmutable $url, string $expiration, string $signature ) : League\Url\UrlImmutable Add expiration and signature query parameters to an url.

Method Details

__construct() public méthode

public __construct ( string $signatureKey, string $expiresParameter = 'expires', string $signatureParameter = 'signature' )
$signatureKey string
$expiresParameter string
$signatureParameter string

getExpirationTimestamp() protected méthode

Retrieve the expiration timestamp for a link based on an absolute DateTime or a relative number of days.
protected getExpirationTimestamp ( DateTime | integer $expiration ) : string
$expiration DateTime | integer The expiration date of this link. - DateTime: The value will be used as expiration date - int: The expiration time will be set to X days from now
Résultat string

getIntendedUrl() protected méthode

Retrieve the intended URL by stripping off the UrlSigner specific parameters.
protected getIntendedUrl ( League\Url\UrlImmutable $url ) : League\Url\UrlImmutable
$url League\Url\UrlImmutable
Résultat League\Url\UrlImmutable

hasValidSignature() protected méthode

Determine if the url has a forged signature.
protected hasValidSignature ( League\Url\UrlImmutable $url ) : boolean
$url League\Url\UrlImmutable
Résultat boolean

isFuture() protected méthode

Check if an a timestamp is in the past.
protected isFuture ( integer $timestamp ) : boolean
$timestamp integer
Résultat boolean

isMissingAQueryParameter() protected méthode

Check if a query is missing a necessary parameter.
protected isMissingAQueryParameter ( League\Url\Components\QueryInterface $query ) : boolean
$query League\Url\Components\QueryInterface
Résultat boolean

sign() public méthode

Get a secure URL to a controller action.
public sign ( string $url, DateTime | integer $expiration ) : string
$url string
$expiration DateTime | integer
Résultat string

signUrl() protected méthode

Add expiration and signature query parameters to an url.
protected signUrl ( League\Url\UrlImmutable $url, string $expiration, string $signature ) : League\Url\UrlImmutable
$url League\Url\UrlImmutable
$expiration string
$signature string
Résultat League\Url\UrlImmutable

validate() public méthode

Validate a signed url.
public validate ( string $url ) : boolean
$url string
Résultat boolean

Property Details

$expiresParameter protected_oe property

The URL's query parameter name for the expiration.
protected string $expiresParameter
Résultat string

$signatureKey protected_oe property

The key that is used to generate secure signatures.
protected string $signatureKey
Résultat string

$signatureParameter protected_oe property

The URL's query parameter name for the signature.
protected string $signatureParameter
Résultat string