PHPackages                             andruby/wx-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. andruby/wx-mini-qrcode

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

andruby/wx-mini-qrcode
======================

微信小程序二维码生成

1.0.1(3y ago)014MITPHPPHP &gt;=7.2

Since Jul 18Pushed 3y ago2 watchersCompare

[ Source](https://github.com/zhmcoder/wx-mini-qrcode)[ Packagist](https://packagist.org/packages/andruby/wx-mini-qrcode)[ Docs](https://github.com/zhmcoder/wx-mini-qrcode)[ RSS](/packages/andruby-wx-mini-qrcode/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

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

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

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

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

```
// 需要的命名空间
use Andruby\WeChat\Mini\QRCode\Log\Logger;
use Andruby\WeChat\Mini\QRCode\Bundle\QRCode;
use Andruby\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('Andruby/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 Andruby\WeChat\Mini\QRCode\Log\Logger;
use Andruby\WeChat\Mini\QRCode\Bundle\QRCode;
use Andruby\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('Andruby/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 Andruby\WeChat\Mini\QRCode\Log\Logger;
use Andruby\WeChat\Mini\QRCode\Bundle\QRCode;
use Andruby\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('Andruby/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

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

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

1400d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/090fe946a2f7190b3c326b4e9102e46f68fb660c29e0c52bb43ec8f59e232776?d=identicon)[322zx](/maintainers/322zx)

---

Tags

qrcode

### Embed Badge

![Health badge](/badges/andruby-wx-mini-qrcode/health.svg)

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

###  Alternatives

[endroid/qr-code

Endroid QR Code

4.8k67.6M348](/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.9M208](/packages/chillerlan-php-qrcode)[bitgrave/barcode-bundle

provide barcode rendering service into your Symfony2 application.

25444.0k1](/packages/bitgrave-barcode-bundle)[devtical/nova-qrcode-field

Nova QR code field

4560.6k2](/packages/devtical-nova-qrcode-field)[amirezaeb/heroqr

A Powerful QR Code Management Library For PHP

9510.3k](/packages/amirezaeb-heroqr)

PHPackages © 2026

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