PHPackages                             php101/php101 - 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. php101/php101

ActiveLibrary

php101/php101
=============

a library by basetwo technology

1.0.0(2y ago)27MITPHP

Since Jul 23Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Muswalo/php101)[ Packagist](https://packagist.org/packages/php101/php101)[ RSS](/packages/php101-php101/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

SecureVault Class Documentation
===============================

[](#securevault-class-documentation)

The SecureVault class provides functionality for encrypting data, generating digital signatures, and working with encrypted files. It utilizes the sodium\_crypto\_secretbox encryption algorithm and the Firebase\\JWT\\JWT library for digital signature generation and verification.

Class Methods:
--------------

[](#class-methods)

1. cipher(string $value, string $key): string

    - Encrypts the given string using the provided key.
    - Parameters:
        - $value (string): The string to be encrypted.
        - $key (string): The encryption key.
    - Returns:
        - Encrypted string.
2. deCipher(string $cipher, string $key): mixed

    - Decrypts the encrypted string and returns the original plaintext string.
    - Parameters:
        - $cipher (string): The encrypted string to be decrypted.
        - $key (string): The decryption key.
    - Returns:
        - The decrypted plaintext string or false if decryption fails.
3. `retrieveJWTFromFile(string $data): string|bool`

    - Retrieves the JWT (JSON Web Token) from the given file content.
    - Parameters:
        - $data (string): The content of the encrypted file.
    - Returns:
        - The JWT if found in the content, or false if not found.
4. fileDecipher(string $file, string $key): array|bool

    - Decrypts the content of an encrypted file and returns the deciphered data as an array.
    - Parameters:
        - $file (string): The path to the encrypted file.
        - $key (string): The decryption key.
    - Throws:
        - Exception if the file does not exist, has an invalid name format, or contains invalid JSON content.
    - Returns:
        - The deciphered data as an array if decryption and verification are successful, or false otherwise.
5. verifySignature(string $fileContent, string $jwt, string $secreteKey): bool

    - Verifies the digital signature of the file content using the provided JWT and secret key.
    - Parameters:
        - $fileContent (string): The content of the encrypted file.
        - $jwt (string): The JSON Web Token (JWT) to be verified.
        - $secreteKey (string): The secret key used for verification.
    - Returns:
        - True if the signature is valid, false otherwise.
6. generateSignature(string $data, string $key, array $extra = \[\]): string

    - Generates a digital signature (JWT) for the given data using the provided key.
    - Parameters:
        - $data (string): The data to be signed.
        - $key (string): The key used for signing.
        - $extra (array): Additional data to include in the signature payload. (Optional)
    - Returns:
        - The generated digital signature (JWT) as a string.
7. encryptToFile(array $fileContent, string $key, string $dir = **DIR**, string $prefix = 'config\_'): bool|int

    - Encrypts the provided file content, generates a digital signature, and writes it to a file.
    - Parameters:
        - $fileContent (array): The data to be encrypted and written to the file.
        - $key (string): The encryption key.
        - $dir (string): The directory where the encrypted file should be stored. (Optional)
        - $prefix (string): The prefix to be added to the file name. (Optional)
    - Throws:
        - Exception if the given directory is not a valid directory.
        - Exception if encryption or signature generation fails.
    - Returns:
        - The number of bytes written to the file on success, or false if an error occurs.

Additional Notes:
-----------------

[](#additional-notes)

- The SecureVault class provides functionality for secure encryption, decryption, and file operations.
- It uses the sodium\_crypto\_secretbox algorithm for encryption, which is considered secure.
- Digital signatures (JWTs) are generated and verified using the HS256 algorithm from the Firebase\\JWT\\JWT library.
- Proper key management and secure storage of sensitive information (such as encryption keys and secret keys) are essential for maintaining the security of the encrypted data.
- Input validation and sanitization should be performed to prevent security vulnerabilities.
- It's recommended to follow secure coding practices and conduct security assessments to ensure the overall security of the application.

For more information, please refer to the class documentation and code comments.

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

1030d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/22375652d29d5ee797c1fb3dd894947f3ccca50a1130cfae7c062e40a25ad746?d=identicon)[Muswalo](/maintainers/Muswalo)

---

Top Contributors

[![Muswalo](https://avatars.githubusercontent.com/u/86104484?v=4)](https://github.com/Muswalo "Muswalo (4 commits)")

### Embed Badge

![Health badge](/badges/php101-php101/health.svg)

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

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.4k37.3k](/packages/matomo-matomo)[simplesamlphp/simplesamlphp

A PHP implementation of a SAML 2.0 service provider and identity provider.

1.1k12.4M193](/packages/simplesamlphp-simplesamlphp)[getkirby/cms

The Kirby core

1.5k535.5k352](/packages/getkirby-cms)[saithink/saiadmin

webman plugin

2709.9k1](/packages/saithink-saiadmin)[jelix/jelix

Jelix PHP framework

83101.5k4](/packages/jelix-jelix)[doppar/framework

The Doppar Framework

366.7k8](/packages/doppar-framework)

PHPackages © 2026

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