base64UrlEncode.php
Table of Contents
Functions
- base64UrlEncode() : string
- Encodes binary data into a base64url string (RFC 4648 §5).
Functions
base64UrlEncode()
Encodes binary data into a base64url string (RFC 4648 §5).
base64UrlEncode(string $binary) : string
The output uses the URL- and filename-safe alphabet (- and _ instead of
+ and /) and omits the trailing = padding, producing the canonical
URL-safe form used by JWT/JOSE, WebPush, signed URLs, etc.
The function is binary-safe: any byte sequence is accepted, including
null bytes and arbitrary UTF-8.
Parameters
- $binary : string
-
Raw bytes to encode. May be empty.
Tags
Return values
string —The base64url-encoded representation, without padding.
Always a subset of [A-Za-z0-9_-].