PHPackages                             liheng/hart-qr-code - 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. liheng/hart-qr-code

ActiveLibrary

liheng/hart-qr-code
===================

hart-qrcode

1.0.0(6y ago)21861MITPHPPHP &gt;=5.4.0

Since Sep 18Pushed 6y ago1 watchersCompare

[ Source](https://github.com/LiHengc/HartCode)[ Packagist](https://packagist.org/packages/liheng/hart-qr-code)[ RSS](/packages/liheng-hart-qr-code/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

Hart QR Code
============

[](#hart-qr-code)

快速生产带背景的二维码，他为你提供了以下功能

- 生产原始二维码，可配置url或则text，以及二维码大小
- 生产带背景带二维码，背景大小是你传入带背景大小，可配置原始二维码大小，原始二维码在背景当中当位置
- 可以直接返回二维码，也可以保存到路径当中

安装
--

[](#安装)

选择 [Composer](https://getcomposer.org/) 进行安装

```
$ composer require liheng/hart-qr-code
```

[使用](https://github.com/LiHengc/HartCode)
-----------------------------------------

[](#使用)

```
use Hart\QrCode\HartQrcode;

//初始化  所有方法都不是必传，选择性传入
/*
 * $url = 'http://www.baidu.com'
 * $path = "v1.png"; 背景地址
 * $save = false; 是否保存到目录
 */
$hartqrCode = new HartQrcode($url, $path, $save);

//创建原始二维码 必须
/*
 * $size = 200;二维码大小
 */
$hartqrCode->create_qrcode($size = 200);

//输出原始二维码
$hartqrCode->get_qrcode();

//创建带背景图的二维码
/*
 * $x = 260; x轴
 * $y = 700; y轴
 * $qrcode_size = 300; 重新定义二维码大小
 */
$hartqrCode->create_bg_qrcode($x = 260, $y = 700, $qrcode_size = 300);

//输出带背景图的二维码
$hartqrCode->get_bg_qrcode();

//获取二维码路径 前提是你不要删除他～
//如果你想获取原始的二维码路径那么请不要创建背景图 反之想获取带背景图的二维码那么请先创建
/*
 * $is_relative = true; 是否获取相对路径
 * $url = ""; 如需拼接url或者路径地址你也可以自己传入
 */
$hartqrCode->get_qrcode_path($is_relative,$url);
```

lssues
------

[](#lssues)

如果有哪里不足或者报错，以及更好的意见请通过[lssues](https://github.com/LiHengc/HartCode/issues)提交

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity53

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

Unknown

Total

1

Last Release

2430d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/49a3a30495ccdf6e972e61f108a5deba6b8d9f861a3fbd829eb5511553d6e7a1?d=identicon)[LiHengc](/maintainers/LiHengc)

---

Top Contributors

[![lihengtt](https://avatars.githubusercontent.com/u/220660168?v=4)](https://github.com/lihengtt "lihengtt (18 commits)")

### Embed Badge

![Health badge](/badges/liheng-hart-qr-code/health.svg)

```
[![Health](https://phpackages.com/badges/liheng-hart-qr-code/health.svg)](https://phpackages.com/packages/liheng-hart-qr-code)
```

###  Alternatives

[nfephp-org/posprint

Thermal POS printer library

7131.7k2](/packages/nfephp-org-posprint)[msp/twofactorauth

Two Factor Authentication module for Magento2 - Member of MageSpecialist SecuritySuite

4462.1k2](/packages/msp-twofactorauth)[blocktrail/blocktrail-sdk

The BlockTrail PHP SDK, for integration of Bitcoin functionality through the BlockTrail API

4921.1k3](/packages/blocktrail-blocktrail-sdk)

PHPackages © 2026

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