attla/pincryp

一层略显谨慎的加密。

dev-main 2023-02-07 06:15 UTC

This package is auto-updated.

Last update: 2024-09-07 09:44:01 UTC


README

License Latest Stable Version Total Downloads

🧛 一层略显谨慎的加密。

安装

composer require attla/pincryp

用法

use Attla\Pincryp\Config;
use Attla\Pincryp\Factory as Pincryp;

// create config instance
$config = new Config();
$config->key = 'hic sunt dracones';
// or
$config = new Config(['key' => 'hic sunt dracones']);

// creating Pincryp instance
$pincryp = new Pincryp($config);

// encoding
$encoded = $pincryp->encode('this is something to encode..');
echo 'encoded: ' . $encoded.PHP_EOL;

$decoded = $pincryp->decode($encoded);
echo 'decoded: ' . $decoded.PHP_EOL;

Pincryp 可以加密所有原始类型: arraystdClassboolstringintegerfloatnull

查看数组加密示例

// encoding
$encoded = $pincryp->encode([
    'name' => 'John Doe',
    'email' => 'john@example.com'
]);
echo 'encoded: ' . $encoded.PHP_EOL;

// to return a stdClass pass the second param as TRUE
$decoded = $pincryp->decode($encoded, false);
echo 'decoded: ' . $decoded.PHP_EOL;

配置参数

许可证

本软件包使用 MIT 许可证 许可,版权所有:Zunq