QR Code
=======
*By [endroid](http://endroid.nl/)*
[![Latest Stable Version](http://img.shields.io/packagist/v/endroid/qrcode.svg)](https://packagist.org/packages/endroid/qrcode)
[![Build Status](http://img.shields.io/travis/endroid/QrCode.svg)](http://travis-ci.org/endroid/QrCode)
[![Total Downloads](http://img.shields.io/packagist/dt/endroid/qrcode.svg)](https://packagist.org/packages/endroid/qrcode)
[![Monthly Downloads](http://img.shields.io/packagist/dm/endroid/qrcode.svg)](https://packagist.org/packages/endroid/qrcode)
[![License](http://img.shields.io/packagist/l/endroid/qrcode.svg)](https://packagist.org/packages/endroid/qrcode)
This library helps you generate QR codes in an easy way and provides a Symfony
bundle for rapid integration in your project.
## Installation
Use [Composer](https://getcomposer.org/) to install the library.
``` bash
$ composer require endroid/qrcode
```
## Basic usage
```php
use Endroid\QrCode\QrCode;
$qrCode = new QrCode('Life is too short to be generating QR codes');
header('Content-Type: '.$qrCode->getContentType());
echo $qrCode->writeString();
```
## Advanced usage
```php
use Endroid\QrCode\ErrorCorrectionLevel;
use Endroid\QrCode\LabelAlignment;
use Endroid\QrCode\QrCode;
use Symfony\Component\HttpFoundation\Response;
// Create a basic QR code
$qrCode = new QrCode('Life is too short to be generating QR codes');
$qrCode->setSize(300);
// Set advanced options
$qrCode
->setWriterByName('png')
->setMargin(10)
->setEncoding('UTF-8')
->setErrorCorrectionLevel(ErrorCorrectionLevel::HIGH)
->setForegroundColor(['r' => 0, 'g' => 0, 'b' => 0])
->setBackgroundColor(['r' => 255, 'g' => 255, 'b' => 255])
->setLabel('Scan the code', 16, __DIR__.'/../assets/noto_sans.otf', LabelAlignment::CENTER)
->setLogoPath(__DIR__.'/../assets/symfony.png')
->setLogoWidth(150)
->setValidateResult(false)
;
// Directly output the QR code
header('Content-Type: '.$qrCode->getContentType());
echo $qrCode->writeString();
// Save it to a file
$qrCode->writeFile(__DIR__.'/qrcode.png');
// Create a response object
$response = new Response($qrCode->writeString(), Response::HTTP_OK, ['Content-Type' => $qrCode->getContentType()]);
```
![QR Code](http://endroid.nl/qrcode/Dit%20is%20een%20test.png)
## Symfony integration
When you use Symfony Flex, the bundle is automatically registered and the
configuration and routes are automatically created when you installed the
package. In other scenarios you can register the bundle as follows.
```php
// app/AppKernel.php
public function registerBundles()
{
$bundles = [
// ...
new Endroid\QrCode\Bundle\QrCodeBundle\EndroidQrCodeBundle(),
];
}
```
The bundle makes use of a factory to create QR codes. The default parameters
applied by the factory can optionally be overridden via the configuration.
```yaml
endroid_qr_code:
writer: 'png'
size: 300
margin: 10
foreground_color: { r: 0, g: 0, b: 0 }
background_color: { r: 255, g: 255, b: 255 }
error_correction_level: low # low, medium, quartile or high
encoding: UTF-8
label: Scan the code
label_font_size: 20
label_alignment: left # left, center or right
label_margin: { b: 20 }
logo_path: '%kernel.root_dir%/../vendor/endroid/qrcode/assets/symfony.png'
logo_width: 150
validate_result: false # checks if the result is readable
```
The readability of a QR code is primarily determined by the size, the input
length, the error correction level and any possible logo over the image. The
`validate_result` option uses a built-in reader to validate the resulting
image. This does not guarantee that the code will be readable by all readers
but this helps you provide a minimum level of quality. Take note that the
validator can consume quite an amount of resources and is disabled by default.
Now you can retrieve the factory from the service container and create a QR
code. For instance in your controller this would look like this.
```php
$qrCode = $this->get('endroid.qrcode.factory')->create('QR Code', ['size' => 200]);
```
Add the following section to your routing to be able to handle QR code URLs.
This step can be skipped if you only use data URIs to display your images.
``` yml
EndroidQrCodeBundle:
resource: "@EndroidQrCodeBundle/Resources/config/routing.yml"
prefix: /qrcode
```
After installation and configuration, QR codes can be generated by appending
the QR code text to the url followed by any of the supported extensions.
## Twig extension
The bundle provides a Twig extension for generating a QR code URL, path or data
URI. You can use the second argument of any of these functions to override any
defaults defined by the bundle or set via your configuration.
``` twig
<img src="{{ qrcode_path(message) }}" />
<img src="{{ qrcode_url(message, { writer: 'eps' }) }}" />
<img src="{{ qrcode_data_uri(message, { writer: 'svg', size: 150 }) }}" />
```
## Versioning
Version numbers follow the MAJOR.MINOR.PATCH scheme. Backwards compatibility
breaking changes will be kept to a minimum but be aware that these can occur.
Lock your dependencies for production and test your code when upgrading.
## License
This bundle is under the MIT license. For the full copyright and license
information please view the LICENSE file that was distributed with this source code.
没有合适的资源?快使用搜索试试~ 我知道了~
V免签 个人开发者免签约收款解决方案 PHP版本
共768个文件
php:512个
gif:75个
js:25个
1星 需积分: 50 34 下载量 156 浏览量
2019-04-22
21:35:14
上传
评论 3
收藏 30.74MB ZIP 举报
温馨提示
V免签 是基于(Thinkphp5.1 + mysql)/ (SpringBoot 2.1.1 ) 实现的一套免签支付程序,主要包含以下特色: + 收款即时到账,无需进入第三方账户,收款更安全 + 提供示例代码简单接入 + 超简单Api使用,提供统一Api实现收款回调 + 免费、开源,无后门风险 + 支持监听店员收款信息,可使用zfb微信小号/模拟器挂机,方便IOS用户 + 免root,免xp框架,不修改zfb/微信客户Duan,防封更安全
资源推荐
资源详情
资源评论
收起资源包目录
V免签 个人开发者免签约收款解决方案 PHP版本 (768个子文件)
v.apk 1.88MB
style.css 142KB
layui.css 68KB
main.css 25KB
global.css 24KB
layer.css 14KB
layui.mobile.css 10KB
laydate.css 7KB
pay.css 5KB
icons-extra.css 3KB
login.css 3KB
mikufont.css 2KB
code.css 1KB
noscript.css 205B
phpunit.xml.dist 1KB
phpunit.xml.dist 893B
phpunit.xml.dist 892B
phpunit.xml.dist 335B
phpunit.xml.dist 335B
phpunit.xml.dist 304B
iconfont.eot 40KB
hiddeninput.exe 9KB
59.gif 10KB
22.gif 10KB
24.gif 8KB
13.gif 7KB
16.gif 7KB
39.gif 6KB
64.gif 6KB
63.gif 6KB
50.gif 6KB
loading-0.gif 6KB
4.gif 6KB
1.gif 5KB
42.gif 5KB
71.gif 5KB
21.gif 5KB
20.gif 5KB
29.gif 5KB
70.gif 4KB
5.gif 4KB
17.gif 4KB
27.gif 4KB
9.gif 4KB
44.gif 4KB
11.gif 4KB
8.gif 4KB
3.gif 4KB
23.gif 4KB
34.gif 4KB
41.gif 4KB
38.gif 4KB
65.gif 3KB
32.gif 3KB
45.gif 3KB
7.gif 3KB
12.gif 3KB
26.gif 3KB
60.gif 3KB
2.gif 3KB
40.gif 3KB
25.gif 3KB
19.gif 3KB
66.gif 3KB
18.gif 3KB
46.gif 3KB
10.gif 3KB
28.gif 3KB
51.gif 3KB
57.gif 3KB
67.gif 3KB
48.gif 3KB
0.gif 3KB
43.gif 3KB
30.gif 2KB
61.gif 2KB
33.gif 2KB
69.gif 2KB
14.gif 2KB
47.gif 2KB
36.gif 2KB
49.gif 2KB
58.gif 2KB
6.gif 2KB
54.gif 2KB
53.gif 2KB
56.gif 2KB
62.gif 2KB
31.gif 2KB
55.gif 2KB
35.gif 2KB
15.gif 2KB
loading-2.gif 2KB
37.gif 1KB
68.gif 1KB
52.gif 777B
loading-1.gif 701B
.gitattributes 140B
.gitignore 84B
.gitignore 81B
共 768 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
- 「已注销」2020-03-13文件不全,大家不下下载了,真是的
- gng7877391582019-08-12这个是你开发的吗,咋看着不像捏,心疼积分,能退不szvone2019-08-13我就是作者,心疼你下干嘛,求你下了?
szvone
- 粉丝: 2
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功