public static function base64Encode($str, $stripEgal = true)
    {
        $str64 = base64_encode($str);
        if ($stripEgal) {
            return rtrim(strtr($str64, '+/', '-_'), '=');
        }
        
        return $str64;
    }