vcode/qrcode
Composer 安装命令:
composer require vcode/qrcode
包简介
This is package generate Qrcode using some services like google qrcode. This package also support attaching logo into qrcode. In Laravel framework, it fully support for using facade, blade helper.
README 文档
README
Introduction
This is package generate Qrcode using some services like google qrcode (currently, it only support google service). This package also support attaching logo into qrcode. In Laravel framework, it fully support for using facade, blade helper.
Reference https://developers.google.com/chart/infographics/docs/qr_code
Installation
- This is require: php5-gd for write image.
Debian: apt-get install php5-gd
RedHat: yum install gd gd-devel php-gd
- Update require in
composer.jsonfile.
"vcode/qrcode": "dev-master"
- You'll then need to run
composer update
- Or
composer require "vcode/qrcode":"dev-master"
LARAVEL USING
File: app/config/app.php
Provider:
'providers' => array( 'Vcode\Qrcode\QrcodeServiceProvider', )
Facade
'aliases' => array( 'Qrcode' => 'Vcode\Qrcode\Facades\Qrcode', )
Create configuration file using artisan
$ php artisan config:publish vcode/qrcode
Using In Controller
$value = "https://github.com/tyanhly/vcode_qrcode"; //or for fully options //$value = array( // 'chs' => "250x250", // 'cht' => "qr", // 'chl' => "https://github.com/tyanhly/vcode_qrcode" // 'chld'=> "H|1", // H(QML)|1, H|2, H|3, H|4, H|10, H|40, // 'choe'=> "UTF-8" // UTF-8, Shift_JIS, ISO-8859-1 //); /** * @param array googleOption * @param string $destinate * @param string $logoPath * @param float $ratioOfLogoOnQrcode * @param int $qrCodeService */ //Qrcode::storageImage(array googleOption, string $destinate, string $logoPath, float $ratioOfLogoOnQrcode, int $qrCodeService); Qrcode::storageImage($value, "/tmp/destination.png", "logo.png", 0.3); /** * @param array googleOption * @param int $qrCodeService */ //Qrcode::render(array googleOption, int $qrCodeService); Qrcode::render($value); /** * @param array googleOption * @param string $logoPath * @param float $ratioOfLogoOnQrcode * @param int $qrCodeService */ //Qrcode::renderBase64(array googleOption, string $logoPath, float $ratioOfLogoOnQrcode, int $qrCodeService); Qrcode::renderBase64($value, "logo.png"); /** * @param array googleOption * @param string $logoPath * @param float $ratioOfLogoOnQrcode * @param int $qrCodeService */ //Qrcode::renderBase64Dome(array googleOption, string $logoPath, float $ratioOfLogoOnQrcode, int $qrCodeService); Qrcode::renderBase64Dom($value, "logo.png");
Using the Blade helper
@qrcode("https://github.com/tyanhly/vcode_qrcode")
@qrcodeBase64Dom("https://github.com/tyanhly/vcode_qrcode", "logo.png", 0.5)
<img src="data:image/png;base64,@qrcodeBase64("https://github.com/tyanhly/vcode_qrcode", "logo.png", 0.5)" />
Using like php library
//Please, reference <this source>/example for more detail include 'vendor/autoload.php'; $qrcode = new Vcode\Qrcode\Qrcode(array( 'qrcode::google_config_default' => array( 'chs' => "250x250", 'cht' => "qr", 'chld'=> "H|1", // H(QML)|1, H|2, H|3, H|4, H|10, H|40, 'choe'=> "UTF-8" // UTF-8, Shift_JIS, ISO-8859-1 ), 'qrcode::template_simple' => './template', 'qrcode::storage_dir' => '/tmp' )); $value = "MECARD:N:XXXXX;ADR:xxx xxxxx xxxxxx xx xxx city;" . "TEL:+XXXXXXXXX;EMAIL:xxxxx@gmail.com;;"; //$qrcode->render($value); $qrcode->renderBase64Dom($value, "logo.png", 0.7);
Example
Change Log
v1.0.0
- First release
v1.0.1
- Base64 encoding
- Storage image
v1.1.0
- Logo attach
- Support like a library, not only for laravel.
vcode/qrcode 适用场景与选型建议
vcode/qrcode 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 465 次下载、GitHub Stars 达 4, 最近一次更新时间为 2015 年 05 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「qrcode」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 vcode/qrcode 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 vcode/qrcode 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 vcode/qrcode 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Based in http://phpqrcode.sourceforge.net/
Symfony 4, 5, 6 ,7 Barcode Generator Bundle with Twig function extension
Generates QR Codes
The jquery qrcode for yii2.
Symfony2 Barcode Generator Bundle with Twig function extension
Alfabank REST API integration
统计信息
- 总下载量: 465
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 21
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-05-09