PHPackages                             semeton/crypto-service - 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. semeton/crypto-service

ActiveLibrary[Security](/categories/security)

semeton/crypto-service
======================

This package provides a simple and secure way to encrypt and decrypt messages in Laravel applications. It uses Sodium cryptographic library for encryption and decryption, ensuring high-level security. The package is easy to integrate into any Laravel application and requires minimal configuration. It's an excellent choice for applications that need to securely store or transmit sensitive information.

1.1.1(2y ago)15MITPHPPHP &gt;=8.0

Since Jan 5Pushed 2y ago1 watchersCompare

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

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

CryptoService
=============

[](#cryptoservice)

CryptoService is a package that provides a simple yet secure way to encrypt and decrypt messages using a secret code. It leverages the power of the Sodium cryptographic library to ensure the highest level of security. This document provides a comprehensive guide on how to install and use CryptoService, along with a detailed explanation of its methods.

Installation
------------

[](#installation)

Installing CryptoService is a breeze with the package manager [composer](https://getcomposer.org/). Follow the link to download and install composer if you have not already. `composer require semeton/crypto-service`

CryptoService Class Documentation
---------------------------------

[](#cryptoserviceclassdocumentation)

### Overview

[](#overview)

The `CryptoService` class provides encryption and decryption services using the Sodium cryptographic library. It uses a secret key of a 64 bits of random string.

### Methods

[](#methods)

#### `encrypt(string $message, string $secretCode): string`

[](#encryptstringmessagestringsecretcodestring)

This method encrypts a given message.

- Parameters: - `$message` (string): The message to be encrypted. - `$secretCode` (string): A secret code used in the encryption process.
- Returns: The encrypted message as a base64-encoded string.
- Description: This method generates a random nonce and uses it along with the `$message` and a hashed combination of `$key` and `$secretCode` to create an encrypted cipher. The cipher is then base64-encoded for safe transmission or storage. The memory of the `$message` and `$key` is cleared after encryption for security reasons.

#### `decrypt(string $encrypted, string $secretCode): string`

[](#decryptstringencryptedstringsecretcodestring)

This method decrypts a given encrypted message.

- Parameters: - `$encrypted` (string): The message to be decrypted. - `$secretCode` (string): A secret code used in the decryption process.
- Returns: The decrypted message as a string. If decryption fails, it returns an error message.
- Description: This method decodes the `$encrypted` message, extracts the nonce and ciphertext, and attempts to decrypt the ciphertext using the nonce and a hashed combination of `$key` and `$secretCode`. If decryption is successful and the result is a string, it returns the decrypted message. If decryption fails or the result is not a string, it returns an error message. The memory of the ciphertext and `$key` is cleared after decryption for security reasons.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

Every ~3 days

Total

2

Last Release

855d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9c8d78e6629f2d5750479a2b78a2a22d803fb430d4970691a948d725b8cc1856?d=identicon)[Semeton](/maintainers/Semeton)

---

Top Contributors

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

---

Tags

laravelsecurityencryptionsodiumdecryption

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/semeton-crypto-service/health.svg)

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

###  Alternatives

[nzo/url-encryptor-bundle

The NzoUrlEncryptorBundle is a Symfony Bundle used to Encrypt and Decrypt data and variables in the Web application or passed through URL

961.0M2](/packages/nzo-url-encryptor-bundle)[al-saloul/encryption

Simple number encryption and decryption package

191.1k](/packages/al-saloul-encryption)

PHPackages © 2026

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