PHPackages                             seffeng/signature - 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. seffeng/signature

ActiveLibrary

seffeng/signature
=================

PHP extension signature

v0.1.7(1y ago)01.9k↓100%1MITPHPPHP &gt;=7.1.3

Since Sep 21Pushed 1y ago1 watchersCompare

[ Source](https://github.com/seffeng/signature)[ Packagist](https://packagist.org/packages/seffeng/signature)[ Docs](https://github.com/seffeng/signature)[ RSS](/packages/seffeng-signature/feed)WikiDiscussions master Synced today

READMEChangelog (8)Dependencies (1)Versions (9)Used By (1)

Signature
=========

[](#signature)

### 安装

[](#安装)

```
# 安装
$ composer require seffeng/signature
```

### 示例

[](#示例)

```
# 示例
use Seffeng\Signature\Signature;
use Seffeng\Signature\Exceptions\SignatureException;

class SiteController extends Controller
{
    public function test()
    {
        try {
            $method = 'GET';
            $uri = '/text';
            $params = ['perPage' => 20];

            $options = [
                /**
                 // 调试模式[false-验证签名，true-不验证签名]
                 'debug'     => false,

                 // 签名使用的哈希算法
                 'algo'      => 'sha1',

                 // 签名验证超时时间
                 'timeout'   => 300,

                 // 接口版本
                 'version'   => '',

                 // 签名前缀[签名字符串前面拼接的字符]
                 'prefix'    => '',

                 // 签名连接符[签名字符串之间拼接的字符]
                 'connector' => '&',

                 // 签名后缀[签名字符串最后拼接的字符]
                 'suffix'    => '',

                 // 请求头app id 对应参数名[$header['Access-Key-Id']]
                 'headerAccessKeyId'     => 'Access-Key-Id',

                 // 请求头时间戳 对应参数名[$header['Timestamp']]
                 'headerTimestamp'       => 'Timestamp',

                 // 请求头Signature对应参数名[$header['Signature']]
                 'headerSignature'       => 'Signature',

                 // 请求头Signature对应标签[$header['Signature'] = "Signature $sign"]
                 'headerSignatureTag'    => 'Signature',

                 // 请求头Signature对应标签[$header['Version'] = 'version']
                 'headerVersion'         => 'Version',
                 */
            ];

            /**
             * 客户端使用签名
             */
            $client = new Signature('access-key-id', 'access-key-secret', $options);
            // $client->setVersion('v1');
            // $client->setAlgo('md5');
            $client->sign($method, $uri, $params);
            $headers = $client->getHeaders();
            print_r($headers);
            // 通过请求传递 $headers，如使用 GuzzleHttp
            // $httpClient = new Client(['base_uri' => 'http://domain.com']);
            // $request = $httpClient->get('/test', ['headers' => $headers, 'query' => $params]);

            /**
             * 服务端验证签名
             */
            $server = new Signature('access-key-id', 'access-key-secret', $options);
            $timestamp = 1600659800;
            $signature = 'Signature TN4kbBUDK7km3B0qjXrHhrtek4Q=';
            // $server->setAlgo('md5');
            // $server->setVersion('v1');
            // $server->setTimeout(60);
            $verify = $server->setTimestamp($timestamp)->verify($signature, $method, $uri, $params);
            var_dump($verify);
            if (!$verify) {
                throw new SignatureException('签名无效！');
            }
        } catch (SignatureException $e) {
            throw $e;
        } catch (\Exception $e) {
            throw $e;
        }
    }
}
```

### 备注

[](#备注)

1、测试脚本 tests/SignatureTest.php 仅作为示例供参考。

###  Health Score

28

—

LowBetter than 57% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity44

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

Recently: every ~253 days

Total

8

Last Release

654d ago

### 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 (11 commits)")

---

Tags

phplaravelsignaturelumenyiiseffeng

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[kra8/laravel-snowflake

Snowflake for Laravel and Lumen.

184386.4k4](/packages/kra8-laravel-snowflake)[dragon-code/support

Support package is a collection of helpers and tools for any project.

238.2M74](/packages/dragon-code-support)[matchory/elasticsearch

The missing elasticsearch ORM for Laravel!

3057.6k](/packages/matchory-elasticsearch)[wxm/pdd-sdk

拼多多 SDK 封装, 调用简单、语义化增强。支持 Laravel/Lumen。

154.7k](/packages/wxm-pdd-sdk)

PHPackages © 2026

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