承接 technicalguru/qrcode 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

technicalguru/qrcode

Composer 安装命令:

composer require technicalguru/qrcode

包简介

Composer-friendly version of phpqrcode

关键字:

README 文档

README

This is PHP implementation of QR Code 2-D barcode generator. It is pure-php LGPL-licensed implementation based on C libqrencode by Kentaro Fukuchi. This fork was restructured to work in a special namespace and with composer.

LICENSE

This project is licensed under GNU LGPL 3.0.

INSTALLATION AND USAGE

By Composer

composer install technicalguru/qrcode

By Package Download

You can download the source code packages from GitHub Release Page

SIMPLE EXAMPLE USAGE

$text = 'This is an example QR code';
$file = __DIR__.'/example-qr.png';

\QR\QRcode::png($text, $file, QR_ECLEVEL_L, 8);

echo 'QR code saved at '.$file;

ADVANCED EXAMPLE USAGE

<?php
include 'vendor/autoload.php';

// set it to writable location, a place for temp generated PNG file
$PNG_TEMP_DIR = dirname(__FILE__).DIRECTORY_SEPARATOR.'qrcodes'.DIRECTORY_SEPARATOR;

// html PNG location prefix
$PNG_WEB_DIR = 'qrcodes/';

// of course we need rights to create temp dir
if (!file_exists($PNG_TEMP_DIR)) {
    mkdir($PNG_TEMP_DIR);
}

$filename = $PNG_TEMP_DIR.'test.png';

// processing form input
// remember to sanitize user input in real-life solution !!!
$errorCorrectionLevel = 'L';
if (isset($_REQUEST['level']) && in_array($_REQUEST['level'], array('L','M','Q','H'))) {
    $errorCorrectionLevel = $_REQUEST['level'];
}

$matrixPointSize = 4;
if (isset($_REQUEST['size'])) {
    $matrixPointSize = min(max((int)$_REQUEST['size'], 1), 10);
}

if (isset($_REQUEST['data'])) {

    // it's very important!
    if (trim($_REQUEST['data']) == '')
        die('data cannot be empty! <a href="?">back</a>');

    // user data
    $filename = $PNG_TEMP_DIR.'test'.md5($_REQUEST['data'].'|'.$errorCorrectionLevel.'|'.$matrixPointSize).'.png';
    \QR\QRcode::png($_REQUEST['data'], $filename, $errorCorrectionLevel, $matrixPointSize, 2);

} else {

    // default data
    echo 'You can provide data in GET parameter: <a href="?data=like_that">like that</a><hr/>';
    \QR\QRcode::png('PHP QR Code :)', $filename, $errorCorrectionLevel, $matrixPointSize, 2);

}

// display generated file
echo '<img src="'.$PNG_WEB_DIR.basename($filename).'" /><hr/>';

// config form
echo '<form method="post">
    Data:&nbsp;<input name="data" value="'.(isset($_REQUEST['data'])?htmlspecialchars($_REQUEST['data']):'PHP QR Code :)').'" />&nbsp;
    ECC:&nbsp;<select name="level">
        <option value="L"'.(($errorCorrectionLevel=='L')?' selected':'').'>L - smallest</option>
        <option value="M"'.(($errorCorrectionLevel=='M')?' selected':'').'>M</option>
        <option value="Q"'.(($errorCorrectionLevel=='Q')?' selected':'').'>Q</option>
        <option value="H"'.(($errorCorrectionLevel=='H')?' selected':'').'>H - best</option>
    </select>&nbsp;
    Size:&nbsp;<select name="size">';

for ($i=1; $i<=10; $i++) {
    echo '<option value="'.$i.'"'.(($matrixPointSize==$i)?' selected':'').'>'.$i.'</option>';
}

echo '</select>&nbsp;
    <input type="submit" value="GENERATE"></form><hr/>';

CONTRIBUTION

Report a bug, request an enhancement or pull request at the GitHub Issue Tracker. Fell free to contact me via e-mail (deltalab at poczta dot fm) or using folowing project pages:

ACKNOWLEDGMENTS

Based on phpqrcode at SourceForge by Dominik Dzienia:

Based on C libqrencode library (ver. 3.1.1) Copyright (C) 2006-2010 by Kentaro Fukuchi http://megaui.net/fukuchi/works/qrencode/index.en.html

QR Code is registered trademarks of DENSO WAVE INCORPORATED in JAPAN and other countries.

Reed-Solomon code encoder is written by Phil Karn, KA9Q. Copyright (C) 2002, 2003, 2004, 2006 Phil Karn, KA9Q

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

technicalguru/qrcode 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 14.7k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2021 年 04 月 17 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 14.7k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0-or-later
  • 更新时间: 2021-04-17