承接 esyede/tiny-qrcode 相关项目开发

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

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

esyede/tiny-qrcode

最新稳定版本:v1.0.0

Composer 安装命令:

composer require esyede/tiny-qrcode

包简介

A tiny QRCode generator (single file, no dependencies)

README 文档

README

screenshot

A tiny QR Code generator (single file, no dependencies)

Requirements:

  • PHP 5.4 or newer
  • PHP-GD exntension

Install

Via composer:

composer require esyede/tiny-qrcode

Manual install:

  1. Download the archive from the release page
  2. Extract the downloaded archive file

Load file

require 'vendor/autoload.php'; // via composer

require 'path/to/TinyQRCode.php'; // manual

Display image

$data = 'https://github.com/esyede/tiny-qrcode';

$qr = new \Esyede\TinyQRCode\TinyQRCode($data);
$qr->display();

Save image

$data = 'https://github.com/esyede/tiny-qrcode';

$qr = new \Esyede\TinyQRCode\TinyQRCode($data);
$qr->store('path/to/store/qr.png');

Adjust QRCode options

Altering the error correction level

$data = 'https://github.com/esyede/tiny-qrcode';
$options = ['errorCorrectionLevel' => 'H'];

$qr = new \Esyede\TinyQRCode\TinyQRCode($data, $options);
$qr->display();

Available error correction levels:

Code Correction Level
L 7%
M 15% (default)
Q 25%
H 30%

Changing the image size

The size of the generated QR image can be adjusted as follows. This does not affect error correction or similar.

$data = 'https://github.com/esyede/tiny-qrcode';
$options = ['imageSize' => 30];

$qr = new \Esyede\TinyQRCode\TinyQRCode($data, $options);
$qr->display();

Changing the code version

The version of the QR code can be altered by passing options to the constructor. Note that in most cases this will result in an increase in image size.

$data = 'https://github.com/esyede/tiny-qrcode';
$options = ['version' => 5]; // range: 1 - 40

$qr = new \Esyede\TinyQRCode\TinyQRCode($data, $options);
$qr->display();

Possible option lists:

Key Type Description
'version' integer Set QR Code version
'imageSize' integer Set output image size
'errorCorrectionLevel' string Set error correction level
'dataPath' string Set custom stub data folder
'imagesPath' string Set custom stub images folder

License

Released under the MIT License

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-12-05