PHP code example of edgaras / custombase64

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

    

edgaras / custombase64 example snippets




use Edgaras\CustomBase64\CustomBase64;

// Default initialization
$base64 = new CustomBase64();

// Custom charset and reversed output
$customChars = 'TPUQVRWXSYZABCDENOFGHIJKLMnopqrstuvwxyzabcdefghijklm0123456789+-';
$reverseOutput = true;
$base64 = new CustomBase64($customChars, $reverseOutput);

$data = "Hello, CustomBase64!";
$encoded = $base64->encode($data);
echo "Encoded: " . $encoded;
// Example output: "=VUC2H2puYHoiO3p1CVSf8WofIWF"

$encoded = "=VUC2H2puYHoiO3p1CVSf8WofIWF";
$decoded = $base64->decode($encoded);
echo "Decoded: " . $decoded;
// Example output: "Hello, CustomBase64!"