PHP code example of y0x54a / base64url-php

1. Go to this page and download the library: Download y0x54a/base64url-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

y0x54a / base64url-php example snippets


use Y0x54a\Base64url\Base64url;

Base64url::encode('foo bar baz');
// Zm9vIGJhciBiYXo

Base64url::decode('Zm9vIGJhciBiYXo');
// foo bar baz

Base64url::validate('Zm9vIGJhciBiYXo=');
// true

Base64url::validate('Zm9vIGJhciBiYXo===');
// false

Base64url::convertBase64ToBase64url('77+/');
// 77-_

Base64url::convertBase64urlToBase64('77-_');
// 77+/