Documentation

Util
in package

Provides utility functions

Table of Contents

base64UrlDecode()  : string
decode a base64 url encoded string
base64UrlEncode()  : string
return the base64 url encoded value of the given string
debug()  : mixed
getCodeChallenge()  : string
generate the code_challenge for PKCE
getRandomCode()  : string
generate a random code
stringEndsWith()  : bool
check if haystack string ends with needle string
stringStartsWith()  : bool
check if haystack string starts with needle string

Methods

base64UrlDecode()

decode a base64 url encoded string

public static base64UrlDecode(string $data[, bool $strict = false ]) : string
Parameters
$data : string

the string to decode

$strict : bool = false

if true, will return false if the input contains character from outside the base64 alphabet

Tags
throws
Exception
Return values
string —

the decoded string

base64UrlEncode()

return the base64 url encoded value of the given string

public static base64UrlEncode(string $data) : string
Parameters
$data : string

the string to encode

Tags
throws
Exception
Return values
string —

the encoded string

debug()

public static debug(mixed $object) : mixed
Parameters
$object : mixed
Return values
mixed —

getCodeChallenge()

generate the code_challenge for PKCE

public static getCodeChallenge(string $code_verifier) : string

code challenge for PKCE

Parameters
$code_verifier : string

the code verifier

Tags
throws
Exception
Return values
string —

the code_challenge

getRandomCode()

generate a random code

public static getRandomCode([int $length = 64 ]) : string

used for generate code_verifier and nonce code verifier for PKCE

Parameters
$length : int = 64

length of generated code

Tags
throws
Exception
Return values
string —

the random code

stringEndsWith()

check if haystack string ends with needle string

public static stringEndsWith(string $haystack, string $needle[, string $case = true ]) : bool
Parameters
$haystack : string

the string to check

$needle : string

the string to check for

$case : string = true

if case sensitive

Tags
throws
Exception
Return values
bool —

true if haystack ends with needle

stringStartsWith()

check if haystack string starts with needle string

public static stringStartsWith(string $haystack, string $needle[, string $case = true ]) : bool
Parameters
$haystack : string

the string to check

$needle : string

the string to check for

$case : string = true

if case sensitive

Tags
throws
Exception
Return values
bool —

true if haystack starts with needle

Search results