PHPackages                             june/data\_security - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. june/data\_security

ActiveLibrary[Security](/categories/security)

june/data\_security
===================

Encrypt and decrypt data and verify signatures

2.1.1(1y ago)030MITPHPPHP &gt;=7.1

Since Aug 25Pushed 1y ago1 watchersCompare

[ Source](https://github.com/JuneSwoole/DataSecurity)[ Packagist](https://packagist.org/packages/june/data_security)[ RSS](/packages/june-data-security/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (4)Used By (0)

DataSecurity
============

[](#datasecurity)

#### Introduce

[](#introduce)

Encrypt and decrypt data using openssl

#### Install

[](#install)

```
composer require june/data_security

```

#### Example

[](#example)

1. symmetry encryption and decryption

```
use june\DataSecurity\Config;
use june\DataSecurity\Openssl;

$data = "Data that needs to be encrypted";

$config = new Config([
    "key"   => "your key",
    "iv"    => 'iv',
    "aad"   => 'aad'
]);
$openssl = new Openssl($config);
$ciphertext = $openssl->encrypted($data);
echo $ciphertext;

$data = $openssl->decryption($ciphertext);
echo $data;

```

2. asymmetry encryption and decryption

```
use june\DataSecurity\Config;
use june\DataSecurity\Openssl;

$data = "Data that needs to be encrypted";

$config = new Config([
    "privateKey" => "",
    "privateKeyFilePath" => "",
    "publicKey" => "",
    "publicKeyFilePath" => "",
]);
$openssl = new Openssl($config);

// Public key encryption
$ciphertext = $openssl->publicEncrypt($data);
echo $ciphertext;
$data = $openssl->privateDecrypt($ciphertext);
echo $data;

// Private key encryption
$ciphertext = $openssl->privateEncrypt($data);
echo $ciphertext;
$data = $openssl->publicDecrypt($ciphertext);
echo $data;

```

3. get signature and verification signature

```
use june\DataSecurity\Config;
use june\DataSecurity\Signature;

$data = [
    "name" => 'june'
];
$config = new Config([
    "appId"      => "your appId",
    "key"        => "your key"
]);
$signature = new Signature($config);
$sign = $signature->sign($data);
echo $sign;

$result = $signature->validate($sign, $data);
echo $result;

$config = new Config([
    "privateKey" => "",
    "privateKeyFilePath" => "",
    "publicKey" => "",
    "publicKeyFilePath" => "",
]);
$signature = new Signature($config);
$sign = $signature->opensslSign($data);
echo $sign;

$result = $signature->opensslVerify($sign, $data);
echo $result;

```

#### Singleton pattern

[](#singleton-pattern)

```
use june\DataSecurity\Config;
use june\DataSecurity\Signature;
use june\DataSecurity\Openssl;

$ciphertext = Openssl::getInstance($config)->encrypted($data);
Openssl::getInstance($config)->decryption($ciphertext);

$ciphertext = Openssl::getInstance($cofig)->publicEncrypt($data);
Openssl::getInstance($config)->privateDecrypt($ciphertext);

$ciphertext = Openssl::getInstance($cofig)->privateEncrypt($data);
Openssl::getInstance($config)->publicDecrypt($ciphertext);

$sign = Signature::getInstance($config)->sign($data);
Signature::getInstance($config)->validate($sign, $data)

$sign = Signature::getInstance($config)->opensslSign($data);
Signature::getInstance($config)->opensslVerify($sign, $data)

```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance46

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 69.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~288 days

Total

3

Last Release

420d ago

Major Versions

1.2.1 → 2.0.02024-06-12

### Community

Maintainers

![](https://www.gravatar.com/avatar/dbbadee031b20656c39e5d40afbc0b7f6aab0878b84c85b0116c3efc8f2c7492?d=identicon)[JuneSwoole](/maintainers/JuneSwoole)

---

Top Contributors

[![JuneSwoole](https://avatars.githubusercontent.com/u/139028108?v=4)](https://github.com/JuneSwoole "JuneSwoole (9 commits)")[![junechen0606](https://avatars.githubusercontent.com/u/119922830?v=4)](https://github.com/junechen0606 "junechen0606 (4 commits)")

### Embed Badge

![Health badge](/badges/june-data-security/health.svg)

```
[![Health](https://phpackages.com/badges/june-data-security/health.svg)](https://phpackages.com/packages/june-data-security)
```

###  Alternatives

[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M214](/packages/defuse-php-encryption)[roave/security-advisories

Prevents installation of composer packages with known security vulnerabilities: no API, simply require it

2.9k97.3M6.4k](/packages/roave-security-advisories)[mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

2.0k16.7M113](/packages/mews-purifier)[robrichards/xmlseclibs

A PHP library for XML Security

41278.1M118](/packages/robrichards-xmlseclibs)[bjeavons/zxcvbn-php

Realistic password strength estimation PHP library based on Zxcvbn JS

86917.5M63](/packages/bjeavons-zxcvbn-php)[enlightn/security-checker

A PHP dependency vulnerabilities scanner based on the Security Advisories Database.

33732.2M110](/packages/enlightn-security-checker)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
