[](https://travis-ci.org/SimpleSoftwareIO/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode) [](https://packagist.org/packages/simplesoftwareio/simple-qrcode)
#### [Español](https://www.simplesoftware.io/simple-qrcode/es) | [Français](https://www.simplesoftware.io/simple-qrcode/fr) | [Italiano](https://www.simplesoftware.io/simple-qrcode/it) | [Português](https://www.simplesoftware.io/simple-qrcode/pt-br) | [РуÑÑкий](https://www.simplesoftware.io/simple-qrcode/ru) | [हिंदी](https://www.simplesoftware.io/simple-qrcode/hi) | [汉è¯](https://www.simplesoftware.io/simple-qrcode/zh)
- [Introduction](#docs-introduction)
- [Translations](#docs-translations)
- [Configuration](#docs-configuration)
- [Simple Ideas](#docs-ideas)
- [Usage](#docs-usage)
- [Helpers](#docs-helpers)
- [Common QrCode Usage](#docs-common-usage)
- [Usage Outside of Laravel](#docs-outside-laravel)
<a id="docs-introduction"></a>
## イントãƒãƒ€ã‚¯ã‚·ãƒ§ãƒ³
Simple QrCode 㯠[Bacon/BaconQrCode](https://github.com/Bacon/BaconQrCode)ã‚’å…ƒã«ä½œã‚‰ã‚ŒãŸ 人気ã®ã‚ã‚‹Laravelフレームワークã§ç°¡å˜ã«ä½¿ã†äº‹ã®ã§ãるラッパーã§ã™ã€‚
Simple QrCode is an easy to use wrapper for the popular Laravel framework based on the great work provided by [Bacon/BaconQrCode](https://github.com/Bacon/BaconQrCode). We created an interface that is familiar and easy to install for Laravel users.
<a id="docs-translations"></a>
## 翻訳
ã“ã®æ–‡æ›¸ã®ç¿»è¨³ã‚’手ä¼ã£ã¦ãれるアラビア語ã€ã‚¹ãƒšã‚¤ãƒ³èªžã€ãƒ•ランス語ã€éŸ“å›½èªžã€æ—¥æœ¬èªžã‚’話ã™ãƒ¦ãƒ¼ã‚¶ãƒ¼ã‚’探ã—ã¦ã„ã¾ã™ã€‚ 翻訳ãŒå¯èƒ½ãªå ´åˆã¯ãƒ—ルリクエストを作æˆã—ã¦ãã ã•ã„。
We are looking for users who speak Arabic, Spanish, French, Korean or Japanese to help translate this document. Please create a pull request if you are able to make a translation!
<a id="docs-configuration"></a>
## è¨å®š
#### Composer
最åˆã«ã‚ãªãŸã® `composer.json` ã« Simple QrCode ãƒ‘ãƒƒã‚±ãƒ¼ã‚¸ã‚’è¿½åŠ ã™ã‚‹å¿…è¦ãŒã‚りã¾ã™ã€‚
"require": {
"simplesoftwareio/simple-qrcode": "~2"
}
è¿½åŠ ã—ãŸã‚‰ `composer update` コマンドを実行ã—ã¾ã™ã€‚
#### サービスプãƒãƒã‚¤ãƒ€ãƒ¼
###### Laravel <= 5.4
(ã‚ãªãŸãŒ Simple QrCode を入れる laravelã®) `config/app.php` ã® `providers`é…列 ã« `SimpleSoftwareIO\QrCode\QrCodeServiceProvider::class` を登録ã—ã¾ã™ã€‚
#### Aliases
###### Laravel <= 5.4
最後㫠`config/app.php` ã® `aliases`é…列㫠`'QrCode' => SimpleSoftwareIO\QrCode\Facades\QrCode::class` を登録ã—ã¾ã™ã€‚
<a id="docs-ideas"></a>
## ã‹ã‚“ãŸã‚“ã«ä½¿ã†
#### ç”»é¢ã«è¡¨ç¤ºã™ã‚‹
ã“ã®ãƒ‘ッケージã®ä¸»ãªã‚¢ã‚¤ãƒ†ãƒ 㯠画é¢ã«è¡¨ç¤ºã™ã‚‹æ©Ÿèƒ½ã§ã™ã€‚
カスタマーã¯ã‚³ãƒ¼ãƒ‰ã‚’スã‚ャンã™ã‚‹ã ã‘ã§ ç”»é¢ã«æˆ»ã‚‹ã“ã¨ãŒå‡ºæ¥ã¾ã™ã€‚以下ã®å†…容をfooter.blade.php ã«è¿½åŠ ã—ã¾ã—ãŸã€‚
<div class="visible-print text-center">
{!! QrCode::size(100)->generate(Request::url()); !!}
<p>Scan me to return to the original page.</p>
</div>
#### QrCodeを埋ã‚込む
ユーザーãŒã™ã°ã‚„ãスã‚ャンã§ãるよã†ã«ã€é›»åメールã®ä¸ã«qrcodeを埋ã‚込むã“ã¨ãŒã§ãã¾ã™ã€‚ 以下ã¯Laravelã§ã“ã‚Œã‚’è¡Œã†æ–¹æ³•ã®ä¾‹ã§ã™ã€‚
//Inside of a blade template.
<img src="{!!$message->embedData(QrCode::format('png')->generate('Embed me into an e-mail!'), 'QrCode.png', 'image/png')!!}">
<a id="docs-usage"></a>
## Usage
#### 基本的ãªä½¿ã„æ–¹
QrCode Generatorを使ã†ã®ã¯ã¨ã¦ã‚‚ç°¡å˜ã§ã™ã€‚ æœ€ã‚‚åŸºæœ¬çš„ãªæ§‹æ–‡ã¯æ¬¡ã®ã¨ãŠã‚Šã§ã™ã€‚
QrCode::generate('Make me into a QrCode!');
ã“れã§ã€ŒMake me into a QrCode!ã€ã¨ã„ã†QrCodeãŒä½œæˆã•れã¾ã™ã€‚
#### 生æˆã™ã‚‹
`Generate`ã¯QrCodeを作るã®ã«ä½¿ã‚れã¾ã™ã€‚
QrCode::generate('Make me into a QrCode!');
>è¦æ³¨æ„: ãƒã‚§ãƒ¼ãƒ³å†…ã§ä½¿ç”¨ã™ã‚‹å ´åˆã¯ã€ã“ã®ãƒ¡ã‚½ãƒƒãƒ‰ã‚’最後ã«å‘¼ã³å‡ºã™å¿…è¦ãŒã‚りã¾ã™ã€‚
`Generate`ã¯ãƒ‡ãƒ•ォルト㧠SVG イメージ文å—列を返ã—ã¾ã™ã€‚
Laravel Bladeã«ä»¥ä¸‹ã®æ§˜ã«æ›¸ãã“ã¨ã§ モダンãªãƒ–ラウザã«è¡¨ç¤ºã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚
{!! QrCode::generate('Make me into a QrCode!'); !!}
`generate`メソッドã®ç¬¬äºŒå¼•æ•°ã¯QrCodeã‚’ä¿å˜ã™ã‚‹ãƒ‘スã¨ãƒ•ァイルãƒãƒ¼ãƒ ã§ã™ã€‚
QrCode::generate('Make me into a QrCode!', '../public/qrcodes/qrcode.svg');
#### フォーマットを変ãˆã‚‹
>QrCode Generator ã®ãƒ‡ãƒ•ォルトフォーマットã¯SVGイメージã§ã™ã€‚
>è¦æ³¨æ„: `format`メソッドã¯` size`〠`color`ã€` backgroundColor`〠`margin`ã®ã‚ˆã†ãªä»–ã®ãƒ•ォーマットオプションã®å‰ã«å‘¼ã°ã‚Œãªã‘れã°ãªã‚Šã¾ã›ã‚“。
ç¾åœ¨PNGã€EPSã€ãŠã‚ˆã³SVGã® 3ã¤ã®ãƒ•ォーマットãŒã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã™ã€‚
フォーマットを変更ã™ã‚‹ã«ã¯ã€æ¬¡ã®ã‚³ãƒ¼ãƒ‰ã‚’使用ã—ã¾ã™ã€‚
QrCode::format('png'); //Will return a PNG image
QrCode::format('eps'); //Will return a EPS image
QrCode::format('svg'); //Will return a SVG image
#### サイズã®å¤‰æ›´
>QrCode Generatorã¯ãƒ‡ãƒ•ォルトã§QrCodeを作æˆã™ã‚‹ãŸã‚ã«ãƒ”クセルã§å¯èƒ½ãªæœ€å°ã‚µã‚¤ã‚ºã‚’è¿”ã—ã¾ã™ã€‚
`size`メソッドを使ã†ã“ã¨ã§QrCodeã®ã‚µã‚¤ã‚ºã‚’変ãˆã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚ æ¬¡ã®æ§‹æ–‡ã‚’使用ã—ã¦ã€å¿…è¦ãªã‚µã‚¤ã‚ºã‚’ピクセルå˜ä½ã§æŒ‡å®šã—ã¾ã™ã€‚
QrCode::size(100);
#### 色ã®å¤‰æ›´
>è¦æ³¨æ„ 色を変ãˆã‚‹ã¨ãã«ã¯æ³¨æ„ã—ã¦ãã ã•ã„。QrCodeã®èªã¿è¾¼ã¿ãŒé›£ã—ããªã‚‹ è‰²ãŒæœ‰ã‚Šã¾ã™ã€‚
ã™ã¹ã¦ã®è‰²ã¯RGB (Red Green Blue)ã§è¡¨ç¾ã™ã‚‹å¿…è¦ãŒã‚りã¾ã™ã€‚ 次ã®ã‚ˆã†ã«ã—ã¦QrCodeã®è‰²ã‚’変更ã§ãã¾ã™:
QrCode::color(255,0,255);
背景色ã®å¤‰æ›´ã‚‚サãƒãƒ¼ãƒˆã•れã¦ãŠã‚Šã€åŒã˜æ–¹æ³•ã§è¡¨ç¾ã§ãã¾ã™ã€‚
QrCode::backgroundColor(255,255,0);
#### マージンã®å¤‰æ›´
QrCode周辺ã®ãƒžãƒ¼ã‚¸ãƒ³ã‚’変更ã™ã‚‹æ©Ÿèƒ½ã‚‚サãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã™ã€‚ æ¬¡ã®æ§‹æ–‡ã‚’使用ã—ã¦ãƒžãƒ¼ã‚¸ãƒ³ã‚’指定ã—ã¾ã™:
QrCode::margin(100);
#### Error Correction
Changing the level of error correction is easy. Just use the following syntax:
QrCode::errorCorrection('H');
The following are supported options for the `errorCorrection` method.
| Error Correction | Assurance Provided |
| --- | --- |
| L | 7% of codewords can be restored. |
| M | 15% of codewords can be restored. |
| Q | 25% of codewords can be restored. |
| H | 30% of codewords can be restored. |
>The more error correction used; the bigger the QrCode becomes and the less data it can store. Read more about [error correction](http://en.wikipedia.org/wiki/QR_code#Error_correction).
#### Encoding
Change the character encoding that is used to build a QrCode. By default `ISO-8859-1` is selected as the encoder. Read more about [character encoding](http://en.wikipedia.org/wiki/Character_encoding) You can change this to any of the following:
QrCode::encoding('UTF-8')->generate('Make me a QrCode with special symbols ♠♥!!');
| Character Encoder |
| --- |
| ISO-8859-1 |
| ISO-8859-2 |
| ISO-8859-3 |
| ISO-8859-4 |
| ISO-8859-5 |
| ISO-8859-6 |
| ISO-8859-7 |
| ISO-8859-8 |
| ISO-8859-9 |
| ISO-8859-10 |
| ISO-8859-11 |
| ISO-8859-12 |
| ISO-8859-13 |
| ISO-8859-14 |
| ISO-8859-15 |
| ISO-8859-16 |
| SHIFT-JIS |
| WINDOWS-1250 |
| WINDOWS-1251 |
| WINDOWS-1252 |
| WINDOWS-1256 |
| UTF-16BE |
| UTF-8 |
| ASCII |
| GBK |
| EUC-KR |
>An error of `Could not encode content to ISO-8859-1` means that the wrong character encoding type is being used. We recommend `UTF-8` if you are unsure.
#### Merge
The `merge` method merges an image over a QrCode. This is commonly used to placed logos within a QrCode.
QrCode::merge($filename, $percentage, $absolute);
//Generates a QrCode with an image centered in the middle.
QrCode::format('png')->merge('path-to-image.png')->generate();
//Generates a QrCode with an image centered in the middle. The inserted image takes up 30% of the QrCode.
QrCode::format('png')->merge('path-to-image.png', .3)->generate();
//Generates a QrCode with an image centered in the middle. The inserted image takes up 30% of the QrCode.
QrCode::format('png')->merge('http://www.google.com/someimage.png', .3, true)->generate();
>The `merge` method only supports PNG at this time.
>The filepath is relative to app base path if `$absolute` is set to `false`. Change this variable to `true` to use absolute paths.
>You should use a high level of error correction when using the `merge` method to ensure that the QrCode is still readable. We recommend using `errorCorrection('H')`.

#### Merge Binary String
The `mergeString` method can be used to achieve the same as the `merge` call, except it allows you to provide a string representation of the file instead of the filepath. This is usefull when working with the `Storage` facade. It's interface is quite similar to the `merge` call.
QrCode::mergeString(Storage::get('path/to/image.png'), $percentage);
//Generates a QrCode with an image centered in the middle.
QrCode::format('png')->mergeString(Storage::get('path/to/image.png'))->generate();
//Generates a QrCode with an image centered in the middle. The inserted image takes up 30% of the QrCode.
QrCode::format('png')->mergeString(Storage::get('path/to/image.png'), .3)->generate();
>As with the normal `merge` call, only PNG is supported at this time. The same applies for error correction, high levels are recommened.
#### Advance Usage
All methods support chaining. The `generate` method must be called last and any `format` change must be called first. For example you could run any of the following:
QrCode::size(250)->color(150,90,10)->backgroundColor(10,14,244)->generate('Make me a QrCode!');
QrCode::format('png')->size(399)->color(40,40,40)->generate('Make me a QrCode!');
You can display a PNG image without saving the file by providing a raw string and encoding with `base64_encode`.
<img src="data:image/png;base64, {!! base64_encode(QrCode::format('png')->size(100)->generate('Make me into an QrCode!')) !!} ">
<a id="docs-helpers"></a>
## Helpers
#### What are helpers?
Helpers are an easy way to create QrCodes that cause a reader to perform a certain action when scanned.
#### BitCoin
This helpers generates a scannable bitcoin to send payments. [More information](https://bitco.in/en/developer-guide#plain-text)
QrCode::BTC($address, $amount);
//Sends a 0.334BTC payment to the address
QrCode::BTC('bitcoin address', 0.334);
//Sends a 0.334BTC payment to the address with some optional arguments
QrCode::size(500)->BTC('address', 0.0034, [
'label' => 'my label',
'message' => 'my message',
'returnAddress' => 'https://www.returnaddress.com'
]);
#### E-Mail
This helper generates an e-mail qrcode that is able to fill in the e-mail address, subject, and body.
QrCode::email($to, $subject, $body);
//Fills in the to address
QrCode::email('foo@bar.com');
//Fills in the to address, subject, and body of an e-mail.
QrCode::email('foo@bar.com', 'This is the subject.', 'This is the message body.');
//Fills in just the subject and body of an e-mail.
QrCode::email(null, 'This is the subject.', 'This is the message body.');
#### Geo
This helper generates a latitude and longitude that a phone can read and open the location up in Google Maps or similar app.
QrCode::geo($latitude, $longitude);
QrCode::geo(37.822214, -122.481769);
#### Phone Number
This helper generates a QrCode that can be scanned and then dials a number.
QrCode::phoneNumber($phoneNumber);
QrCode::phoneNumber('555-555-5555');
QrCode::phoneNumber('1-800-Laravel');
#### SMS (Text Messages)
This helper makes SMS messages that can be prefilled with the send to address and body of the message.
QrCode::SMS($phoneNumber, $message);
//Creates a text message with the number filled in.
QrCode::SMS('555-555-5555');
//Creates a text message with the number and message filled in.
QrCode::SMS('555-555-5555', 'Body of the message');
#### WiFi
This helpers makes scannable QrCodes that can connect a phone to a WiFI network.
QrCode::wiFi([
'encryption' => 'WPA/WEP',
'ssid' => 'SSID of the network',
'password' => 'Password of the network',
'hidden' => 'Whether the network is a hidden SSID or not.'
]);
//Connects to an open WiFi network.
QrCode::wiFi([
'ssid' => 'Network Name',
]);
//Connects to an open, hidden WiFi network.
QrCode::wiFi([
'ssid' => 'Network Name',
'hidden' => 'true'
]);
//Connects to an secured, WiFi network.
QrCode::wiFi([
'ssid' => 'Network Name',
'encryption' => 'WPA',
'password' => 'myPassword'
]);
>WiFi scanning is not currently supported on Apple Products.
<a id="docs-common-usage"></a>
## Common QrCode Usage
You can use a prefix found in the table below inside the `generate` section to create a QrCode to store more advanced information:
QrCode::generate('http://www.simplesoftware.io');
| Usage | Prefix | Example |
| --- | --- | --- |
| Website URL | http:// | http://www.simplesoftware.io |
| Secured URL | https:// | https://www.simplesoftware.io |
| E-mail Address | mailto: | mailto:support@simplesoftware.io |
| Phone Number | tel: | tel:555-555-5555 |
| Text (SMS) | sms: | sms:555-555-5555 |
| Text (SMS) With Pretyped Message | sms: | sms::I am a pretyped message |
| Text (SMS) With Pretyped Message and Number | sms: | sms:555-555-5555:I am a pretyped message |
| Geo Address | geo: | geo:-78.400364,-85.916993 |
| MeCard | mecard: | MECARD:Simple, Software;Some Address, Somewhere, 20430;TEL:555-555-5555;EMAIL:support@simplesoftware.io; |
| VCard | BEGIN:VCARD | [See Examples](https://en.wikipedia.org/wiki/VCard) |
| Wifi | wifi: | wifi:WEP/WPA;SSID;PSK;Hidden(True/False) |
<a id="docs-outside-laravel"></a>
## Usage Outside of Laravel
You may use this package outside of Laravel by instantiating a new `BaconQrCodeGenerator` class.
use SimpleSoftwareIO\QrCode\BaconQrCodeGenerator;
$qrcode = new BaconQrCodeGenerator;
$qrcode->size(500)->generate('Make a qrcode without Laravel!');