GeneratorInterface
in
Table of Contents
Methods
- __toString() : string
- Generate a new token and return it as a string.
- create() : static
- Create a new token generator instance.
- toArray() : array<string|int, mixed>
- Generate a new token and return it as an array.
- toString() : string
- Generate a new token and return it as a string.
Methods
__toString()
Generate a new token and return it as a string.
public
__toString() : string
Tags
Return values
stringcreate()
Create a new token generator instance.
public
static create(OpenSSLAsymmetricKey|string $signingKey[, string $algorithm = Token::ALGO_RS256 ][, array<string|int, mixed> $claims = [] ][, array<string|int, string> $headers = [] ][, null|string $signingKeyPassphrase = null ]) : static
Parameters
- $signingKey : OpenSSLAsymmetricKey|string
-
Signing key to use for signing the token. This MUST be a string for HS256. MUST be either a string or OpenSSLAsymmetricKey for RS256.
- $algorithm : string = Token::ALGO_RS256
-
Algorithm to use for signing the token. Defaults to RS256.
- $claims : array<string|int, mixed> = []
-
Claims to include in the token. Defaults to an empty array.
- $headers : array<string|int, string> = []
-
Headers to include in the token. Defaults to an empty array. The the "alg" header will be set to represent $algorithm appropriately.
- $signingKeyPassphrase : null|string = null
-
Optional. Passphrase to use for signing key if it is encrypted. Defaults to null.
Tags
Return values
statictoArray()
Generate a new token and return it as an array.
public
toArray([bool $encodeSegments = true ]) : array<string|int, mixed>
Parameters
- $encodeSegments : bool = true
-
Whether to encode the segments or not. Defaults to true.
Tags
Return values
array<string|int, mixed>toString()
Generate a new token and return it as a string.
public
toString() : string