Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/reyesoft/crypto-qr
https://github.com/reyesoft/crypto-qr
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/reyesoft/crypto-qr
- Owner: reyesoft
- License: mit
- Created: 2018-07-30T00:24:14.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-10-08T17:04:41.000Z (3 months ago)
- Last Synced: 2024-10-29T00:43:05.746Z (2 months ago)
- Language: PHP
- Size: 121 KB
- Stars: 5
- Watchers: 5
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Crypto-QR
*By [Reyesoft](http://reyesoft.com/)*
This library helps you generate QR codes for Crypto Address. Makes use of [endroid/qr-code](https://github.com/endroid/qr-code). Further extended with Twig extensions, generation routes, a factory and a
## Installation
Use [Composer](https://getcomposer.org/) to install the library.
``` bash
$ composer require reyesoft/crypto-qr
```## Basic usage
```php
use Reyesoft\CryptoQr\BitcoinQr;$qr = new BitcoinQr('3PrCdjyjcDHDSC8tvVgx1u96tMK9juncHs');
header('Content-Type: '.$qr->getQrCode()->getContentType());
echo $qr->getQrCode()->writeString();
```## Advanced usage
```php
use Reyesoft\CryptoQr\BitcoinQr;// Create a basic QR code
$qr = new BitcoinQr('3PrCdjyjcDHDSC8tvVgx1u96tMK9juncHs');
$qr->getQrCode()->setSize(300);
$qr->setAmount(0.01);
$qr->setLabel('Caritas');
$qr->setMessage('Donation for project Maria');// Directly output the QR code
header('Content-Type: '.$qr->getQrCode()->getContentType());
echo $qr->getQrCode()->writeString();// Save it to a file
$qr->getQrCode()->writeFile(__DIR__.'/qrcode.png');
````getQrCode()` return a instance of `Endroid\QrCode\QrCode`, then you have more options for your QR on
[endroid/qr-code](https://github.com/endroid/qr-code/blob/master/README.md#advanced-usage).![bitcoin qr](https://user-images.githubusercontent.com/938894/44047859-1c4b94b0-9f06-11e8-85d7-ea7d3728691c.png "Bitcoin QR generated with BitcoinQr library")
## Testing
```bash
composer test
sh autofix.sh
```### PHP 7.3
```bash
docker run -it --rm --name php73 -e PHP_EXTENSIONS="gd" -v "$PWD":/usr/src/app thecodingmachine/php:7.3-v4-cli bash
```