php-simple-jwt/src/JWTUtil.php

16 lines
321 B
PHP
Raw Normal View History

2021-02-11 12:22:51 +00:00
<?php
2023-04-09 00:40:21 +00:00
namespace NoccyLabs\SimpleJWT;
2021-02-11 12:22:51 +00:00
2023-04-09 00:40:21 +00:00
class JWTUtil
2021-02-11 12:22:51 +00:00
{
public static function encode($data) {
return rtrim(str_replace(['+', '/'], ['-', '_'], base64_encode($data)), "=");
}
public static function decode($data) {
return base64_decode(str_replace(['-', '_'], ['+', '/'], $data));
}
}