├── .gitignore
├── .travis.yml
├── src
├── Exceptions
│ ├── EmptyTextException.php
│ └── MalformedUrlException.php
├── Facades
│ └── QRCode.php
├── Providers
│ └── QRCodeServiceProvider.php
└── QRCodeFactory.php
├── docs
├── .sass-cache
│ └── 441d4a9fb29c4706d6f17735c2df4713963ec2fb
│ │ ├── normalize.scssc
│ │ ├── variables.scssc
│ │ ├── rouge-github.scssc
│ │ └── jekyll-theme-cayman.scssc
├── _config.yml
├── text.md
├── me-card.md
├── url.md
├── phone.md
├── sms.md
├── email.md
├── wi-fi.md
├── calendar.md
├── index.md
├── v-card.md
└── _layouts
│ └── default.html
├── Gemfile
├── CONTRIBUTING.md
├── SECURITY.md
├── .github
└── ISSUE_TEMPLATE
│ ├── feature_request.md
│ └── bug_report.yaml
├── composer.json
├── LICENSE.md
├── README.md
└── CODE_OF_CONDUCT.md
/.gitignore:
--------------------------------------------------------------------------------
1 | _site/
2 | .idea/
3 | vendor/
4 | composer.lock
5 | Gemfile.lock
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: php
2 | php:
3 | - '7.1'
4 | install: composer install
--------------------------------------------------------------------------------
/src/Exceptions/EmptyTextException.php:
--------------------------------------------------------------------------------
1 | = 0.1.0' if Gem.win_platform?
4 |
5 | if Gem.win_platform?
6 | gem 'github-pages', '170', group: :jekyll_plugins
7 | else
8 | gem 'github-pages', group: :jekyll_plugins
9 | end
--------------------------------------------------------------------------------
/docs/text.md:
--------------------------------------------------------------------------------
1 | > [Laravel QR Code Generator](index.md) >> [QR Code Types](index.md#code-types) >> Text
2 |
3 | ---
4 | # Text
5 |
6 | ```php
7 | png();
11 | });
12 | ```
--------------------------------------------------------------------------------
/docs/me-card.md:
--------------------------------------------------------------------------------
1 | > [Laravel QR Code Generator](index.md) >> [QR Code Types](index.md#code-types) >> meCard
2 |
3 | ---
4 | # meCard
5 |
6 | ```php
7 | svg();
11 | });
12 | ```
--------------------------------------------------------------------------------
/docs/url.md:
--------------------------------------------------------------------------------
1 | > [Laravel QR Code Generator](index.md) >> [QR Code Types](index.md#code-types) >> URL
2 |
3 | ---
4 | # URL
5 |
6 | ```php
7 | setSize(8)
12 | ->setMargin(2)
13 | ->png();
14 | });
15 | ```
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | To contribute to this project, please do the following:
2 |
3 | - Fork it
4 | - Create a new branch for your contribution
5 | - Test it! Make sure it works and it won't break the master code
6 | - Send pull request
7 |
8 | Contributors will be added to package descriptor
9 |
10 | Make sure you abide to the [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md)
--------------------------------------------------------------------------------
/docs/phone.md:
--------------------------------------------------------------------------------
1 | > [Laravel QR Code Generator](index.md) >> [QR Code Types](index.md#code-types) >> Phone
2 |
3 | ---
4 | # Phone
5 |
6 | ```php
7 | setSize(4)
12 | ->setMargin(2)
13 | ->png();
14 | });
15 | ```
--------------------------------------------------------------------------------
/docs/sms.md:
--------------------------------------------------------------------------------
1 | > [Laravel QR Code Generator](index.md) >> [QR Code Types](index.md#code-types) >> SMS
2 |
3 | ---
4 | # SMS
5 |
6 | ```php
7 | setSize(4)
12 | ->setMargin(2)
13 | ->png();
14 | });
15 | ```
--------------------------------------------------------------------------------
/docs/email.md:
--------------------------------------------------------------------------------
1 | > [Laravel QR Code Generator](index.md) >> [QR Code Types](index.md#code-types) >> Email Message
2 |
3 | ---
4 | # Email Message
5 |
6 | ```php
7 | png();
17 |
18 | });
19 | ```
--------------------------------------------------------------------------------
/src/Facades/QRCode.php:
--------------------------------------------------------------------------------
1 |
12 | *
13 | * @package LaravelQRCode\Facades
14 | */
15 | class QRCode extends Facade
16 | {
17 | protected static function getFacadeAccessor() {
18 | return 'qr-code';
19 | }
20 | }
--------------------------------------------------------------------------------
/docs/wi-fi.md:
--------------------------------------------------------------------------------
1 | > [Laravel QR Code Generator](index.md) >> [QR Code Types](index.md#code-types) >> Wi-fi Network Settings
2 |
3 | ---
4 | # Wi-fi Network Settings
5 |
6 | ```php
7 | setOutfile('images/my-wifi.png')
17 | ->png();
18 | });
19 | ```
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 | # Security Policy
2 |
3 | ## Supported Versions
4 |
5 | Use this section to tell people about which versions of your project are
6 | currently being supported with security updates.
7 |
8 | | Version | Supported |
9 | | ------- | ------------------ |
10 | | 1.x | :white_check_mark: |
11 |
12 | ## Reporting a Vulnerability
13 |
14 | Use this section to tell people how to report a vulnerability.
15 |
16 | Tell them where to go, how often they can expect to get an update on a
17 | reported vulnerability, what to expect if the vulnerability is accepted or
18 | declined, etc.
19 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "giauphan/laravel-qr-code",
3 | "description": "QR Code Generator for PHP wrapper for Laravel",
4 | "license": "MIT",
5 | "authors": [
6 | {
7 | "name": "Phan Nhut Giau",
8 | "email": "giauphan012@gmail.com"
9 | }
10 | ],
11 | "minimum-stability": "dev",
12 | "require": {
13 | "giauphan/qr-code":"1.0.2"
14 | },
15 | "autoload": {
16 | "psr-4": {
17 | "LaravelQRCode\\": "src/"
18 | }
19 | },
20 | "extra": {
21 | "laravel": {
22 | "providers": [
23 | "LaravelQRCode\\Providers\\QRCodeServiceProvider"
24 | ],
25 | "aliases": {
26 | "QRCode": "LaravelQRCode\\Facades\\QRCode"
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/docs/calendar.md:
--------------------------------------------------------------------------------
1 | > [Laravel QR Code Generator](index.md) >> [QR Code Types](index.md#code-types) >> Calendar Event
2 |
3 | ---
4 | # Calendar Event
5 |
6 | ```php
7 | svg();
21 | });
22 | ```
23 |
24 |
--------------------------------------------------------------------------------
/src/Providers/QRCodeServiceProvider.php:
--------------------------------------------------------------------------------
1 |
13 | *
14 | * @package LaravelQRCode\Providers
15 | */
16 | class QRCodeServiceProvider extends ServiceProvider
17 | {
18 | /**
19 | * Bootstrap the application services.
20 | *
21 | * @return void
22 | */
23 | public function boot()
24 | {
25 | //
26 | }
27 |
28 | /**
29 | * Register the application services.
30 | *
31 | * @return void
32 | */
33 | public function register()
34 | {
35 | $this->app->bind('qr-code', function () {
36 | return new QRCodeFactory();
37 | });
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | **(MIT)**
2 |
3 | Copyright 2023 Giauphan
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6 |
7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 |
9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Laravel QR Code Generator
2 |
3 | Create QR Codes with Laravel
4 |
5 | This is a wrapper for [QR Code Generator for PHP], a standalone library to generate QR Codes in PNG and SVG.
6 |
7 | ## Installation
8 |
9 | Install using **composer**:
10 |
11 | ```bash
12 | composer require giauphan/laravel-qr-code:v1.0.3
13 | ```
14 | ##### Laravel 5.4 (5.5+ can skip this step)
15 |
16 | You need to add provider and alias to your `config/app.php` file:
17 |
18 | ```php
19 | [
22 |
23 | LaravelQRCode\Providers\QRCodeServiceProvider::class,
24 |
25 | ],
26 |
27 |
28 | 'aliases' => [
29 |
30 | 'QRCode' => LaravelQRCode\Facades\QRCode::class,
31 |
32 | ]
33 | ```
34 | ## QR Code Types
35 |
36 | Laravel QR Code Generator supports the following QR Codes:
37 |
38 | - Calendar Event
39 | - Email Message
40 | - Phone
41 | - SMS
42 | - Text
43 | - URL
44 | - meCard
45 | - vCard v3
46 | - Wi-fi Network Settings
47 |
48 | ## Usage
49 |
50 | ```php
51 | setOutfile($path )
58 | ->png();
59 | return '';
60 | });
61 |
62 | ```
63 | The above route should print a PNG image for a text QR Code.
64 |
65 |
66 | ## [Contributing](CONTRIBUTING.md)
67 |
68 | To contribute to this project, please do the following:
69 |
70 | - Fork it
71 | - Create a new branch for your contribution
72 | - Test it! Make sure it works and it won't break the master code
73 | - Send pull request
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/docs/index.md:
--------------------------------------------------------------------------------
1 | # Laravel QR Code Generator
2 |
3 | Create QR Codes with Laravel
4 |
5 | This is a wrapper for [QR Code Generator for PHP](https://giauphan.github.io/qr-code), a standalone library to generate QR Codes in PNG and SVG.
6 |
7 | ## Installation
8 |
9 | Install using **composer**:
10 |
11 | ```bash
12 | $ composer require giauphan/laravel-qr-code
13 | ```
14 | ##### Laravel 5.4 (5.5+ can skip this step)
15 |
16 | You need to add provider and alias to your `config/app.php` file:
17 |
18 | ```php
19 | [
22 |
23 | LaravelQRCode\Providers\QRCodeServiceProvider::class,
24 |
25 | ],
26 |
27 |
28 | 'aliases' => [
29 |
30 | 'QRCode' => LaravelQRCode\Facades\QRCode::class,
31 |
32 | ]
33 | ```
34 | ## QR Code Types
35 |
36 | Laravel QR Code Generator supports the following QR Codes:
37 |
38 | - [Calendar Event](calendar.md)
39 | - [Email Message](email.md)
40 | - [Phone](phone.md)
41 | - [SMS](sms.md)
42 | - [Text](text.md)
43 | - [URL](url.md)
44 | - [meCard](me-card.md)
45 | - [vCard v3](v-card.md)
46 | - [Wi-fi Network Settings](wi-fi.md)
47 |
48 | ### Common Options
49 |
50 | These options are available to any of the QR Code types above.
51 |
52 | Option | Return value | Expected Values
53 | -------|:-------------|:---------------
54 | `setErrorCorrectionLevel($level)`|$this|'L','M','Q' or 'H'
55 | `setSize(4)`|$this| Pixel size. 1 to 10
56 | `setMargin(3)`|$this| 1 to 10
57 | `setOutfile($file)`|$this|file path (public) and name.ext to save QR Code
58 | `png()`| |stream (or save if outfile is set) QR Code as a PNG image
59 | `svg()`| |stream (or save if outfile is set) QR Code as an SVG image
60 |
61 | ## Notes
62 |
63 | - If you set an outfile, you **MUST make sure the path exists**.
64 | Don't forget to **set filename extension** according to your output (.png or .svg).
65 | - Since SVGs are scalable, use them to make complex QR Codes such as [Calendar Events](calendar.md), [meCards](me-card.md) and [vCards](v-card.md)
--------------------------------------------------------------------------------
/docs/v-card.md:
--------------------------------------------------------------------------------
1 | > [Laravel QR Code Generator](index.md) >> [QR Code Types](index.md#code-types) >> vCard v3
2 |
3 | ---
4 | # vCard v3
5 |
6 | ```php
7 | 'home',
24 | 'pref' => true,
25 | 'street' => '123 my street st',
26 | 'city' => 'My Beautiful Town',
27 | 'state' => 'LV',
28 | 'country' => 'Neverland',
29 | 'zip' => '12345-678'
30 | ];
31 | $wordAddress = [
32 | 'type' => 'work',
33 | 'pref' => false,
34 | 'street' => '123 my work street st',
35 | 'city' => 'My Dreadful Town',
36 | 'state' => 'LV',
37 | 'country' => 'Hell',
38 | 'zip' => '12345-678'
39 | ];
40 |
41 | $addresses = [$homeAddress, $wordAddress];
42 |
43 | // Phones
44 | $workPhone = [
45 | 'type' => 'work',
46 | 'number' => '001 555-1234',
47 | 'cellPhone' => false
48 | ];
49 | $homePhone = [
50 | 'type' => 'home',
51 | 'number' => '001 555-4321',
52 | 'cellPhone' => false
53 | ];
54 | $cellPhone = [
55 | 'type' => 'work',
56 | 'number' => '001 9999-8888',
57 | 'cellPhone' => true
58 | ];
59 |
60 | $phones = [$workPhone, $homePhone, $cellPhone];
61 |
62 | return QRCode::vCard($firstName, $lastName, $title, $email, $company, $job, $url, $addresses, $phones)
63 | ->setErrorCorrectionLevel('H')
64 | ->setSize(4)
65 | ->setMargin(2)
66 | ->svg();
67 | });
68 | ```
69 |
70 | ### Notes
71 |
72 | - You can have only one preferential address
73 | - Error Correction Level is set to H(igh) because there is a lot of information
74 | - Try using SVG when encoding complex information, since you can re-scale the image file at will without loss of quality
75 |
--------------------------------------------------------------------------------
/docs/_layouts/default.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |