PHP code example of antikirra / base64url

1. Go to this page and download the library: Download antikirra/base64url 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/ */

    

antikirra / base64url example snippets




use function Antikirra\base64url_decode;
use function Antikirra\base64url_encode;

GQh
echo base64url_encode('火 剄る 불');    // 54GrIOWJhOOCiyDrtog

// Decode back
echo base64url_decode('SGVsbG8gV29ybGQh'); // Hello World!
echo base64url_decode('54GrIOWJhOOCiyDrtog'); // 火 剄る 불

// Invalid input returns false
var_dump(base64url_decode('invalid@chars!')); // bool(false)

base64url_encode('test'); // dGVzdA

base64url_decode('dGVzdA'); // test
base64url_decode('inv@lid'); // false