PHPackages                             seffeng/laravel-rsa - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. seffeng/laravel-rsa

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

seffeng/laravel-rsa
===================

PHP laravel extension rsa

v1.0.0(4y ago)79.8k↓48.5%1MITPHPPHP &gt;=7.1.3

Since May 20Pushed 2y ago1 watchersCompare

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

READMEChangelog (7)Dependencies (1)Versions (8)Used By (0)

Laravel RSA
-----------

[](#laravel-rsa)

### 安装

[](#安装)

```
# 安装
$ composer require seffeng/laravel-rsa
```

##### Laravel

[](#laravel)

```
# 1、生成配置文件
$ php artisan vendor:publish --tag="rsa"

# 2、生成key文件，多个客户端时可以指定client，对应配置文件中 clients 的配置，如：
# php artisan rsa:generate default
$ php artisan rsa:generate
```

##### lumen

[](#lumen)

```
# 1、将以下代码段添加到 /bootstrap/app.php 文件中的 Providers 部分
$app->register(Seffeng\LaravelRSA\RSAServiceProvider::class);

# 2、生成key文件，多个客户端时可以指定client，对应配置文件中 clients 的配置，如：
# php artisan rsa:generate other-client
$ php artisan rsa:generate
```

```
# 服务端
# /storage 目录下对应 public key 提供给客户端用于加密和签名；
# 使用 private key 解密、验证签名；

# 客户端
# 接收其他服务端提供的 public key 替换 /storage 目录下对应 public key 用于加密和签名；
# 使用 public key 加密、签名
```

### 示例

[](#示例)

```
use Seffeng\LaravelRSA\Facades\RSA;
use Seffeng\LaravelRSA\Exceptions\RSAException;

class SiteController extends Controller
{
    public function test()
    {
        try {
            // 多个客户端使用其他配置时，对应配置文件中 clients 的配置
            // RSA::loadClient('other-client');

            $plaintext = '123456';
            // 加密
            $entext = RSA::encrypt($plaintext);
            // 解密
            $detext = RSA::decrypt($entext);

            // 使用其他key
            // RSA::loadKey('-----BEGIN PUBLIC KEY-----......');
            // RSA::loadKey('-----BEGIN PRIVATE KEY-----......');

            $message = 'a=aaa&b=bbb&c=ccc';
            // 签名
            $sign = RSA::sign($message);
            // 签名验证
            $verify = RSA::verify($message, $sign);

            var_dump(base64_encode($entext), $detext);
            var_dump(base64_encode($sign), $verify);
        } catch (RSAException $e) {
            var_dump($e->getMessage());
        } catch (\Exception $e) {
            var_dump($e->getMessage());
        }
    }
}
```

项目依赖
----

[](#项目依赖)

依赖仓库地址备注seffeng/cryptlib无### 备注

[](#备注)

无

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity55

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 ~73 days

Recently: every ~108 days

Total

7

Last Release

1749d ago

Major Versions

v0.1.5 → v1.0.02021-08-04

### Community

Maintainers

![](https://www.gravatar.com/avatar/30b3d8cc986a1ad37a55169b11812fea1cae31430dd8dbe1b3436dc58cc885bd?d=identicon)[seffeng](/maintainers/seffeng)

---

Top Contributors

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

---

Tags

phplaravelrsalumenseffeng

### Embed Badge

![Health badge](/badges/seffeng-laravel-rsa/health.svg)

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

###  Alternatives

[kra8/laravel-snowflake

Snowflake for Laravel and Lumen.

188402.3k6](/packages/kra8-laravel-snowflake)

PHPackages © 2026

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