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

ActiveLibrary[Security](/categories/security)

switon/crypto
=============

Encryption, decryption, and key handling utilities for Switon Framework

v1.0.0(1mo ago)021MITPHPPHP &gt;=8.3CI passing

Since May 10Pushed 1mo agoCompare

[ Source](https://github.com/switon-php/crypto)[ Packagist](https://packagist.org/packages/switon/crypto)[ Docs](https://github.com/switon-php/crypto)[ RSS](/packages/switon-crypto/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (2)Versions (2)Used By (1)

Switon Crypto Package
=====================

[](#switon-crypto-package)

Encryption, decryption, and key handling utilities for Switon Framework.

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

[](#installation)

```
composer require switon/crypto
```

**Requirements:** PHP 8.3+, `ext-openssl`, `ext-mbstring`

Quick Start
-----------

[](#quick-start)

```
use Switon\Core\Attribute\Autowired;
use Switon\Crypto\CipherInterface;

class UserProfileService
{
    #[Autowired] protected CipherInterface $cipher;

    public function encryptProfile(int $userId, array $profile): string
    {
        return $this->cipher->encrypt(
            json_encode($profile, JSON_THROW_ON_ERROR),
            "user:{$userId}"
        );
    }

    public function decryptProfile(int $userId, string $encrypted): array
    {
        $json = $this->cipher->decrypt($encrypted, "user:{$userId}", 'json');

        return json_decode($json, true, flags: JSON_THROW_ON_ERROR);
    }
}
```

Docs:

License
-------

[](#license)

MIT.

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance94

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community8

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

Unknown

Total

1

Last Release

31d ago

### Community

Maintainers

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

---

Top Contributors

[![switon-php](https://avatars.githubusercontent.com/u/247358032?v=4)](https://github.com/switon-php "switon-php (5 commits)")

---

Tags

cryptoencryptionkeysopensslswitonencryptioncryptoopensslkeysswiton

### Embed Badge

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

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

###  Alternatives

[defuse/php-encryption

Secure PHP Encryption Library

3.9k170.7M239](/packages/defuse-php-encryption)[phpseclib/phpseclib

PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.

5.6k455.2M1.4k](/packages/phpseclib-phpseclib)[ionux/phactor

Phactor is a high-performance PHP implementation of the elliptic curve math functions required to generate &amp; verify private/public (asymmetric) EC keypairs and ECDSA signatures based on secp256k1 curve parameters. This library also includes a class to generate Service Identification Numbers (SINs) based on the published Identity Protocol v1 spec.

5283.3k30](/packages/ionux-phactor)[mmeyer2k/dcrypt

A petite library of encryption functionality for PHP

98772.6k1](/packages/mmeyer2k-dcrypt)[acmephp/core

Raw implementation of the ACME protocol in PHP

401.0M7](/packages/acmephp-core)[vlucas/pikirasa

PKI public/private RSA key encryption using the OpenSSL extension

104104.1k1](/packages/vlucas-pikirasa)

PHPackages © 2026

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