mirror of
https://github.com/MarijnDoeve/TijdVoorDeTest.git
synced 2026-03-05 20:44:19 +01:00
22 lines
440 B
PHP
22 lines
440 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tvdt\Helpers;
|
|
|
|
use Safe\Exceptions\UrlException;
|
|
|
|
class Base64
|
|
{
|
|
public static function base64UrlEncode(string $input): string
|
|
{
|
|
return mb_rtrim(strtr(base64_encode($input), '+/', '-_'), '=');
|
|
}
|
|
|
|
/** @throws UrlException */
|
|
public static function base64UrlDecode(string $input): string
|
|
{
|
|
return \Safe\base64_decode(strtr($input, '-_', '+/'), true);
|
|
}
|
|
}
|