jysperu/php-qr-code 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

jysperu/php-qr-code

最新稳定版本:2.0.2

Composer 安装命令:

composer require jysperu/php-qr-code

包简介

Based in http://phpqrcode.sourceforge.net/

README 文档

README

This source is base in v1.1.4 (2010100721) of phpqrcode.sourceforge.net
I just modified and fixed a little bit of code.

REQUIREMENTS

  • PHP7.2
  • PHP GD2 extension with JPEG and PNG support

QUICK START WIDTH COMPOSER

composer require jysperu/php-qr-code

<?php
require_once '/path/to/vendor/autoload.php';

QUICK START WIDTHOUT COMPOSER

<?php
spl_autoload_register(function ($class) {
    static $dir = '/path/to/src';
    static $spc = '\\';

    $class = trim($class, $spc);
    $parts = explode($spc, $class);
    $base  = array_shift($parts);

    if ($base <> 'QRcode' or count($parts) === 0) return;

    $parts = implode(DIRECTORY_SEPARATOR, $parts);
    $file = $dir . DIRECTORY_SEPARATOR . $parts . '.php';

    if (file_exists($file))
        require_once $file;
});

EXAMPLES

Saving PNG image

use QRcode\QRcode;
use QRcode\QRstr;

$data = 'Hello World!';
$dest = __DIR__ . '/qr.png';

QRcode :: png ($data, $dest, QRstr :: QR_ECLEVEL_L, 4, 2);
## Expected: New file

Saving WEBP image

use QRcode\QRcode;
use QRcode\QRstr;

$data = 'Hello World!';
$dest = __DIR__ . '/qr.webp';

QRcode :: webp ($data, $dest, QRstr :: QR_ECLEVEL_L, 4, 2);
## Expected: New file

Printing PNG image

use QRcode\QRcode;
use QRcode\QRstr;

$data = 'Hello World!';

QRcode :: png ($data, FALSE, QRstr :: QR_ECLEVEL_L, 4, 2);
## Expected: Header: Content-type: image/png

Printing WEBP image

use QRcode\QRcode;
use QRcode\QRstr;

$data = 'Hello World!';

QRcode :: webp ($data, FALSE, QRstr :: QR_ECLEVEL_L, 4, 2);
## Expected: Header: Content-type: image/webp

Getting PNG image data

use QRcode\QRcode;
use QRcode\QRstr;

$data = 'Hello World!';

$base64_data = QRcode :: base64_png ($data, QRstr :: QR_ECLEVEL_L, 4, 2);
## Expected: $base64_data = data:image/png;base64,....

Getting WEBP image data

use QRcode\QRcode;
use QRcode\QRstr;

$data = 'Hello World!';

$base64_data = QRcode :: base64_webp ($data, QRstr :: QR_ECLEVEL_L, 4, 2);
## Expected: $base64_data = data:image/webp;base64,....

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2022-03-09