Elgg  Version 3.0
Base64Url.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Security;
4 
10 class Base64Url {
11 
18  public static function encode($bytes) {
19  $bytes = base64_encode($bytes);
20  $bytes = rtrim($bytes, '=');
21  return strtr($bytes, '+/', '-_');
22  }
23 
30  public static function decode($bytes) {
31  $bytes = strtr($bytes, '-_', '+/');
32  return base64_decode($bytes);
33  }
34 }
Encode and decode Base 64 URL.
Definition: Base64Url.php:10
static decode($bytes)
Decode base 64 URL.
Definition: Base64Url.php:30
static encode($bytes)
Encode base 64 URL.
Definition: Base64Url.php:18