edgaras/custombase64
最新稳定版本:1.0.0
Composer 安装命令:
composer require edgaras/custombase64
包简介
A PHP package for customizable Base64 encoding and decoding with support for custom character sets and optional reversed output.
README 文档
README
A PHP package for customizable Base64 encoding and decoding with support for custom character sets and optional reversed output.
Features
- Customizable Base64 character sets.
- Optional reversed output for encoding/decoding.
Requirements
PHP 8+
Installation
- Use the library via Composer:
composer require edgaras/custombase64
- Include the Composer autoloader:
require __DIR__ . '/vendor/autoload.php';
Usage
1. Initialization
You can initialize the CustomBase64 class with optional parameters:
use Edgaras\CustomBase64\CustomBase64; // Default initialization $base64 = new CustomBase64(); // Custom charset and reversed output $customChars = 'TPUQVRWXSYZABCDENOFGHIJKLMnopqrstuvwxyzabcdefghijklm0123456789+-'; $reverseOutput = true; $base64 = new CustomBase64($customChars, $reverseOutput);
2. Encoding data
Use the encode method to convert data into custom Base64 format:
$data = "Hello, CustomBase64!"; $encoded = $base64->encode($data); echo "Encoded: " . $encoded; // Example output: "=VUC2H2puYHoiO3p1CVSf8WofIWF"
3. Decoding Data
Decode Base64-encoded strings back to their original form using the decode method:
$encoded = "=VUC2H2puYHoiO3p1CVSf8WofIWF"; $decoded = $base64->decode($encoded); echo "Decoded: " . $decoded; // Example output: "Hello, CustomBase64!"
统计信息
- 总下载量: 150
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-01-25