定制 smakecloud/laravel-sodium 二次开发

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

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

smakecloud/laravel-sodium

最新稳定版本:v0.0.2

Composer 安装命令:

composer require smakecloud/laravel-sodium

包简介

Laravel libsodium

README 文档

README

phpunit phpstan

Uses PHP's Sodium extension to encrypt, decrypt, sign and verify data.

Note Package name was chosen for discoverability. It is not affiliated with Laravel.

Supported encryption ciphers are:

Supported signing algorithms are:

Signing KeyPair is generated using app.key for seeding.

Warning This package overrides Laravel's Encrypter class!

You will lose support for the following ciphers:

  • AES-128-CBC
  • AES-256-CBC
  • AES-128-GCM

Table of Contents

Requirements

  • PHP 8.1+
  • Sodium extension ( obviously )

Installation

You can install the package via composer:

composer require smakecloud/laravel-sodium

This package uses Laravel's auto-discovery feature. After you install it the package provider and facade are available immediately.

Usage

This package overrides Laravel's Encrypter class. You can use it as you would use the default Encrypter class.

You can change the default cipher in:

config/app.php

return [
    //...

    'cipher' => 'XCha-Cha20-Poly1305',

    //...
]
$encrypted = encrypt('secret');
$decrypted = decrypt($encrypted); // 'secret'

$signed = sign('secret');
$verified = verify($signed); // 'secret'

$signature = sign_detached('secret');
$verified = verify_detached($signature, 'secret'); // true

Development

Testing

composer test

Coverage

composer test:coverage

Static analysis

composer phpstan

Code style

composer lint(:fix)

Disclaimer

This package is not affiliated with Laravel in any way.

Read the documentation of PHPs sodium extension before using this package !

We don't take any responsibility for any damage caused by this package.

License

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

统计信息

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

GitHub 信息

  • Stars: 3
  • Watchers: 4
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-06-21