for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Rogierw\RwAcme\Support;
class Base64
{
public static function urlSafeEncode(string $input): string
return str_replace('=', '', strtr(base64_encode($input), '+/', '-_'));
}
public static function urlSafeDecode(string $input): string
$remainder = strlen($input) % 4;
if ($remainder) {
$padlen = 4 - $remainder;
$input .= str_repeat('=', $padlen);
return base64_decode(strtr($input, '-_', '+/'));