public static function base64Encode($data, $url = false)
    {
        if ($url) {
            return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
        } else {
            return base64_encode($data);
        }
    }
public static function base64Encode($data, $url = false)
    {
        if ($url) {
            return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
        } else {
            return base64_encode($data);
        }
    }
public static function base64Encode ( $ data , $ url = false ) { if ( $ url ) { return rtrim ( strtr ( base64_encode ( $ data ) , '+/' , '-_' ) , '=' ) ; } else { return base64_encode ( $ data ) ; } }
Encode binary data using base64.

@param string $data
String.
@param bool $url
'base64url' standard. Removes padding and replaces '+'
and '/' with '-' and '_'.
@return string Base64 encoded string.
Encode binary data using base64 .