life2016/yii2-qrcode-helper
Composer 安装命令:
composer require life2016/yii2-qrcode-helper
包简介
Create QrCodes based on libqrencode C library.
README 文档
README
QrCode helper allows you to render QrCodes on your Yii2 applications.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require life2016/yii2-qrcode-helper:~1.0
or add
"life2016/yii2-qrcode-helper" : "~1.0"
to the require section of your application's composer.json file.
Usage
The helper comes with some format helper classes that will help you to create the different type of QrCodes that a mobile phone scanner will understand.
The library comes with the following formats:
- Bitcoin
- BookMark
- Geo
- iCal
- MailMessage
- MailTo
- MeCard
- MMS
- Phone
- Sms
- vCard
- Wifi
- Youtube
There are many more out there, we hope the community will helps us improve the library with facebook, google maps,
youtube, and market links. If not, we will add them whenever we have time :)
To render the qrcode, add this to your HTML page:
<img src="<?= Url::to(['route/qrcode'])?>" />
Now, use it on your action:
use dosamigos\qrcode\formats\MailTo; use dosamigos\qrcode\QrCode; \\ ... public function actionQrcode() { $mailTo = new MailTo(['email' => 'email@example.com']); return QrCode::png($mailTo->getText()); // you could also use the following // return return QrCode::png($mailTo); }
That's it, you should have a beautiful QrCode image on your website.
Testing
$ phpunit
Contributing
Please see CONTRIBUTING for details.
Credits
License
The BSD License (BSD). Please see License File for more information.
Web development has never been so fun!
www.2amigos.us
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2021-06-21