定制 sextanet/aduana 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

sextanet/aduana

最新稳定版本:1.0.4

Composer 安装命令:

composer require sextanet/aduana

包简介

Bidirectional channel to encrypt and decypt data

README 文档

README

Latest Version on Packagist Tests Total Downloads

A robust and easy-to-use package with bidirectional support to encrypt and decrypt data with AES-256-CBC.

The original name Aduana is inspired by @uppercod's aduana

Installation

You can install the package via composer:

composer require sextanet/aduana

Basic usage

Note

Since version 1.0.3, the password needs to be at least 10 characters

Encrypt text

// Step 1: set a password
\SextaNet\Aduana\Aduana::setPassword('yourSecurePassword');

// Step 2: encrypt your data
return \SextaNet\Aduana\Aduana::encrypt('hello, from Aduana (:');

Returns encrypted text, like this: dWSNOkN6mqxeCH0v3mzbWlJxRDJWTGE1WUxSQnN1eVNlbCtuNzdlOTFWSDUybFJIYVluNGNDMFZ4ajQ9

Decrypt text

// Step 1: set a password
\SextaNet\Aduana\Aduana::setPassword('yourSecurePassword');

// Step 2: decrypt your data
return \SextaNet\Aduana\Aduana::decrypt('dWSNOkN6mqxeCH0v3mzbWlJxRDJWTGE1WUxSQnN1eVNlbCtuNzdlOTFWSDUybFJIYVluNGNDMFZ4ajQ9');

Returns your original text: hello, from Aduana (:

Advanced usage

You can also encrypt complex structures like arrays. With the same syntax to encrypt and decrypt 😎

Encrypt an array

\SextaNet\Aduana\Aduana::setPassword('yourSecurePassword');

$array = [
    'your-complex-array' => [
        'another-level' => [
            'yes' => [
                'it works!' => [
                    'no problem!',
                ]
            ]
        ]
    ]
];

return \SextaNet\Aduana\Aduana::encrypt($array);

Decrypt an array

$decrypted_array = \SextaNet\Aduana\Aduana::decrypt('zwKOVw6zX2Jp8gNdQuE6TWRyNUR4MFFpN2lVaGIyeHZBMUljQXA1d2VuYjFZR3RKVkkzNC9HR25RampMUEQrSTdRbHVOT3VUU2hDL04rVXErSVNRL0FvTlAyMjRWa1pRVjdRS1RuSTFvRFBkRHVjMm9Pbm0ySnVnNnJVPQ==');

var_dump($decrypted_array);

Emojis (new)

Aduana supports three emojis:

Set password

Aduana::🔑('verySecretPassword');

Encrypt

Aduana::🔒('Hello, from Aduana!');

Decrypt

Aduana::🔓('Fvt2y2Q1Y26c1oh1Zr1YpXR2KzJKVlYyZzd5OUFpdEUyNi91MkR1UTMvMmtSbnVtWXhYVk5FU2Z2VWs9');

Functions

If you don't want to use PSR-4 and their imports, you can also use functions

Set password

aduana_password('verySecretPassword');

Encrypt

aduana_encrypt('Hello, from Aduana!');

Decrypt

aduana_decrypt('Fvt2y2Q1Y26c1oh1Zr1YpXR2KzJKVlYyZzd5OUFpdEUyNi91MkR1UTMvMmtSbnVtWXhYVk5FU2Z2VWs9');

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 20
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-12-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固