PHPackages                             namesfang/wechat-mini-qrcode - 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. namesfang/wechat-mini-qrcode

ActiveLibrary

namesfang/wechat-mini-qrcode
============================

微信小程序二维码生成

1.0.1(5y ago)075↓100%MITPHPPHP &gt;=7.2

Since Feb 1Pushed 5y ago1 watchersCompare

[ Source](https://github.com/namesfang/wechat-mini-qrcode)[ Packagist](https://packagist.org/packages/namesfang/wechat-mini-qrcode)[ Docs](https://github.com/namesfang/wechat-mini-qrcode)[ RSS](/packages/namesfang-wechat-mini-qrcode/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

### 微信小程序二维码生成

[](#微信小程序二维码生成)

##### 生成有限制数量二维码示例

[](#生成有限制数量二维码示例)

```
// 需要的命名空间
use Namesfang\WeChat\Mini\QRCode\Log\Logger;
use Namesfang\WeChat\Mini\QRCode\Bundle\QRCode;
use Namesfang\WeChat\Mini\QRCode\Bundle\QRCodeOption;

// 示例需要，实际项目中无需要引入
define('ROOT_PATH', dirname(__DIR__));
define('LOG_PATH',  sprintf('%s/logs', ROOT_PATH));
spl_autoload_register(function ($className) {
    $className = str_replace('\\', '/', $className);
    $className = str_replace('Namesfang/WeChat/Mini/QRCode/', '', $className);
    require_once sprintf('%s/src/%s.php', ROOT_PATH, $className);
});

// +-----------------------------------------------------------
// | 日志记录
// | 自行封装需要实现 LoggerInterface 接口类
// +-----------------------------------------------------------
$logger = new Logger(LOG_PATH, true);

// 参数配置
$option = new QRCodeOption('k88NSXiADADIN');
$option->setPath('pages/my/index/index?id=23');
$option->setWidth(320);

// 实例化
$qrcode = new QRCode($option, $logger);

$ret = $qrcode->create();

if($ret->error) {
    die($ret->error);
}

if('image/jpeg' == $ret->header['Content-Type']) {
    file_put_contents(LOG_PATH.'/a.jpg', $ret->original);
} else {
    die($ret->errmsg);
}

```

##### 生成有限制数量微信小程序二维码示例

[](#生成有限制数量微信小程序二维码示例)

```
// 需要的命名空间
use Namesfang\WeChat\Mini\QRCode\Log\Logger;
use Namesfang\WeChat\Mini\QRCode\Bundle\QRCode;
use Namesfang\WeChat\Mini\QRCode\Bundle\WeChatQRCodeOption;

// 示例需要，实际项目中无需要引入
define('ROOT_PATH', dirname(__DIR__));
define('LOG_PATH',  sprintf('%s/logs', ROOT_PATH));
spl_autoload_register(function ($className) {
    $className = str_replace('\\', '/', $className);
    $className = str_replace('Namesfang/WeChat/Mini/QRCode/', '', $className);
    require_once sprintf('%s/src/%s.php', ROOT_PATH, $className);
});

// +-----------------------------------------------------------
// | 日志记录
// | 自行封装需要实现 LoggerInterface 接口类
// +-----------------------------------------------------------
$logger = new Logger(LOG_PATH, true);

// 参数配置
$option = new WeChatQRCodeOption('k88NSXiADADIN');
$option->setPath('pages/my/index/index?id=23');
$option->setLineColor(33, 99, 240);

// 实例化
$qrcode = new QRCode($option, $logger);

$ret = $qrcode->create();

if($ret->error) {
    die($ret->error);
}

if('image/jpeg' == $ret->header['Content-Type']) {
    file_put_contents(LOG_PATH.'/b.jpg', $ret->original);
} else {
    die($ret->errmsg);
}

```

##### 生成暂无限制数量的小程序二维码示例

[](#生成暂无限制数量的小程序二维码示例)

```
// 需要的命名空间
use Namesfang\WeChat\Mini\QRCode\Log\Logger;
use Namesfang\WeChat\Mini\QRCode\Bundle\QRCode;
use Namesfang\WeChat\Mini\QRCode\Bundle\WeChatQRCodeUnlimitOption;

// 示例需要，实际项目中无需要引入
define('ROOT_PATH', dirname(__DIR__));
define('LOG_PATH',  sprintf('%s/logs', ROOT_PATH));
spl_autoload_register(function ($className) {
    $className = str_replace('\\', '/', $className);
    $className = str_replace('Namesfang/WeChat/Mini/QRCode/', '', $className);
    require_once sprintf('%s/src/%s.php', ROOT_PATH, $className);
});

// +-----------------------------------------------------------
// | 日志记录
// | 自行封装需要实现 LoggerInterface 接口类
// +-----------------------------------------------------------
$logger = new Logger(LOG_PATH, true);

// 参数配置
$option = new WeChatQRCodeUnlimitOption('k88NSXiADADIN');
$option->setPage('pages/my/index/index');
$option->setScene('id=123748');
$option->setLineColor(33, 99, 240);

// 实例化
$qrcode = new QRCode($option, $logger);

$ret = $qrcode->create();

if($ret->error) {
    die($ret->error);
}

if('image/jpeg' == $ret->header['Content-Type']) {
    file_put_contents(LOG_PATH.'/unlimit.jpg', $ret->original);
} else {
    die($ret->errmsg);
}

```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

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

Total

2

Last Release

1919d ago

### Community

Maintainers

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

---

Top Contributors

[![namesfang](https://avatars.githubusercontent.com/u/5258216?v=4)](https://github.com/namesfang "namesfang (3 commits)")

---

Tags

qrcode

### Embed Badge

![Health badge](/badges/namesfang-wechat-mini-qrcode/health.svg)

```
[![Health](https://phpackages.com/badges/namesfang-wechat-mini-qrcode/health.svg)](https://phpackages.com/packages/namesfang-wechat-mini-qrcode)
```

###  Alternatives

[tecnickcom/tcpdf

TCPDF is a PHP class for generating PDF documents and barcodes.

4.5k101.8M472](/packages/tecnickcom-tcpdf)[endroid/qr-code

Endroid QR Code

4.8k67.6M347](/packages/endroid-qr-code)[simplesoftwareio/simple-qrcode

Simple QrCode is a QR code generator made for Laravel.

2.9k27.6M92](/packages/simplesoftwareio-simple-qrcode)[chillerlan/php-qrcode

A QR Code generator and reader with a user-friendly API. PHP 8.4+

2.4k28.9M207](/packages/chillerlan-php-qrcode)[milon/barcode

Barcode generator like Qr Code, PDF417, C39, C39+, C39E, C39E+, C93, S25, S25+, I25, I25+, C128, C128A, C128B, C128C, 2-Digits UPC-Based Extention, 5-Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI (Variation of Plessey code)

1.5k13.3M39](/packages/milon-barcode)[pragmarx/google2fa-qrcode

QR Code package for Google2FA

12024.6M37](/packages/pragmarx-google2fa-qrcode)

PHPackages © 2026

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