定制 abduns/qrcode 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

abduns/qrcode

Composer 安装命令:

composer require abduns/qrcode

包简介

A from-scratch, framework-agnostic QR Code generator for PHP 8.2+ with zero required runtime dependencies.

README 文档

README

A from-scratch, framework-agnostic QR Code generator for PHP 8.2+ with zero required runtime dependencies.

Tests Version Downloads License

Features

  • Modern PHP support
  • Lightweight and fast
  • Typed API
  • Framework agnostic
  • Standards-oriented
  • Extensible architecture
  • Zero runtime dependencies
  • Three renderers (SVG, PNG, Console)
  • ISO/IEC 18004 compliant
  • Payload helpers (URL, vCard, Event, etc.)

Installation

composer require abduns/qrcode

Quick Start

use Dunn\QrCode\QrCode;
use Dunn\QrCode\EccLevel;
use Dunn\QrCode\Renderer\Svg\SvgRenderer;

$qr = QrCode::create('https://example.com')
    ->errorCorrection(EccLevel::Quartile)
    ->build();

$svg = (new SvgRenderer(size: 300, margin: 4))->render($qr);
file_put_contents('qr.svg', $svg);

Why This Package?

  • Existing solutions are outdated
  • Missing modern PHP features
  • Poor developer experience
  • No standards compliance
  • Too framework-coupled

This package focuses on simplicity, interoperability, and modern developer ergonomics.

Usage

Basic Usage

use Dunn\QrCode\QrCode;

// Payload helpers
QrCode::url('https://example.com')->build();
QrCode::text('hello')->build();
QrCode::phone('+14155550123')->build();
QrCode::sms('+14155550123', body: 'hi')->build();
QrCode::email('a@b.com', subject: 'hello', body: 'hi')->build();
QrCode::geo(37.7749, -122.4194, label: 'SF')->build();

Advanced Usage

use Dunn\QrCode\Renderer\Svg\SvgRenderer;
use Dunn\QrCode\Style\Color;
use Dunn\QrCode\Style\Logo;
use Dunn\QrCode\Style\ModuleShape\DotModule;
use Dunn\QrCode\Style\EyeStyle\CircleEyeOuter;
use Dunn\QrCode\Style\EyeStyle\SquareEyeInner;

$renderer = new SvgRenderer(
    size: 360,
    margin: 4,
    background: Color::hex('#fafafa'),

    // Data dots: round, dark navy.
    moduleShape: new DotModule(),
    dotColor: Color::hex('#264653'),

    // Marker outer ring: round, teal.
    eyeOuter: new CircleEyeOuter(),
    markerOuterColor: Color::hex('#2a9d8f'),

    // Marker inner pupil: square, terracotta.
    eyeInner: new SquareEyeInner(),
    markerInnerColor: Color::hex('#e76f51'),

    // Optional center logo
    logo: Logo::fromFile(__DIR__ . '/logo.png', sizeRatio: 0.18),
);

$svg = $renderer->render($qr);

Configuration

All renderers are highly configurable directly via their constructors.

use Dunn\QrCode\Renderer\Png\GdPngRenderer;
use Dunn\QrCode\Renderer\Console\ConsoleRenderer;

$png = (new GdPngRenderer(size: 300))->render($qr);
echo (new ConsoleRenderer(margin: 2))->render($qr);

Standards / Specifications

  • ISO/IEC 18004
  • RFC 3966 (tel)
  • RFC 6068 (mailto)
  • RFC 5870 (geo)

References:

Supported Features

Feature Support
SVG Renderer
PNG Renderer
Console Renderer
Custom Colors & Gradients
Custom Logos

Compatibility

Platform Supported
PHP 8.2+
Laravel ✅ (via laravel-qrcode)

Design Goals

  • Developer experience first
  • Predictable APIs
  • Minimal dependencies
  • Strong typing
  • Extensibility
  • Interoperability
  • Byte-exact ISO/IEC 18004 compliance

Architecture

  • immutable objects
  • independent encoding logic
  • rendering adapters

Performance

Operation Time
Parse & Encode 2ms
Serialize SVG 1ms

Testing

composer test

Roadmap

  • Kanji mode
  • Micro QR
  • Structured Append

Contributing

Contributions, issues, and discussions are welcome.

Security

If you discover security issues, please report them responsibly.

License

MIT

abduns/qrcode 适用场景与选型建议

abduns/qrcode 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 162 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 05 月 11 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「barcode」 「qrcode」 「png」 「qr」 「svg」 「qr-code」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 abduns/qrcode 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 abduns/qrcode 我们能提供哪些服务?
定制开发 / 二次开发

基于 abduns/qrcode 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 162
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 60
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-11