PHPackages                             oh86/sm - 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. oh86/sm

ActiveLibrary

oh86/sm
=======

v1.6(1y ago)01.4k—0%14PHP

Since Sep 17Pushed 1y ago1 watchersCompare

[ Source](https://github.com/OneHundred86/sm)[ Packagist](https://packagist.org/packages/oh86/sm)[ RSS](/packages/oh86-sm/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (8)Used By (4)

##### 一、安装

[](#一安装)

```
composer require "oh86/sm"
```

##### 二、配置

[](#二配置)

1. 添加下面一行到 `config/app.php` 中 `providers` 部分：

    ```
    Oh86\Sm\SmServiceProvider::class,

    ```
2. 发布配置文件与资源

    ```
    php artisan vendor:publish --provider='Oh86\Sm\SmServiceProvider'

    ```
3. 配置.env

    ```
    SM4_KEY=08c8e6db4907dc755a6097d0abd417c5	# hex

    SM2_PRIVATE_KEY=afbee3c2367df945294f39f23fac1678b4e7b4bc18b69a33890ae21bc6e43830 # hex
    SM2_PUBLIC_KEY=04145c4a725692115e45e6c147bebc4e25ec024569b6e8589d2bcc9181a1cfe401747d8593d7f8fad8ba45635ea6a7c514555bd3298ccdae8e2391ae782b00d09d # hex

    ```

三、使用示例

```
>>> sm3("123");
=> "6e0f9e14344c5406a0cf5a3b4dfb665f87f4a771a31f7edbb5c72874a32b2957"
>>>
>>> $encrypt = sm4_encrypt("hello world")
=> "f7064332db25a4ab8615721c49f49ee6"
>>> sm4_decrypt($encrypt)
=> "hello world"
>>>
>>> $encrypt = sm2_encrypt("hello world")
>>> sm2_decrypt($encrypt)
>>>
>>> $sign = sm2_sign("hello world")
>>> sm2_verify("hello world", $sign)
>>>
>>> $sign = sm2_sign_without_asn1("hello world")
>>> sm2_verify_without_asn1("hello world", $sign)
>>>

```

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance49

Moderate activity, may be stable

Popularity19

Limited adoption so far

Community14

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

Recently: every ~246 days

Total

7

Last Release

377d ago

### Community

Maintainers

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

---

Top Contributors

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

### Embed Badge

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

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

PHPackages © 2026

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