Skip to content

Helper Functions

Public Functions

  • request()

    Get the request instance. Example: $request = request();

Utils Class

  • randomString(string $type = 'alnum', int $len = 8) Generate a random string.

    Example: Utils::randomString('alnum', 8)

  • getBetweenString(string $input, $start, $end) Return the content between two strings.

    Example: Utils::getBetweenString('alnum', 'l', 'm')

Stdio Class

  • println($msg, string $color = "info")

    Output a line of message in the specified color on the console. If $msg is an array or an object, it will be JSON-encoded. Example: Stdio::println('Execute database query')

  • error($msg)

    Output a line of error message (in red) on the console. If $msg is an array or an object, it will be JSON-encoded. Example: Stdio::error('Program error')