-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from 2amigos/develop
Develop/master
- Loading branch information
Showing
142 changed files
with
5,331 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# yii console command | ||
/yii | ||
|
||
/laravel | ||
# phpstorm project files | ||
.idea | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
|
||
<?php | ||
return [ | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Component Prefix | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Defines the prefix for the component | ||
| | ||
*/ | ||
'prefix' => '2am', | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| QR Code Size | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Defines the default size for the generated qrcode. | ||
| | ||
*/ | ||
'size' => 300, | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| QR Code Margin | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Defines the default margin for the generated qrcode. | ||
| | ||
*/ | ||
'margin' => 15, | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| QR Code Logo | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Defines the default logo path for the generated qrcode. | ||
| A full path should be provided. | ||
| By default, the logo image will be resized to be square shaped, you can change this | ||
| behavior by setting scaleLogoHeight to true | ||
| | ||
*/ | ||
'logoPath' => null, | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| QR Scale Logo Height | ||
|-------------------------------------------------------------------------- | ||
| | ||
*/ | ||
'scaleLogoHeight' => false, | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| QR Logo Size | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Defines the default logo size for the generated qrcode. | ||
| The suggested size is the 16% of the QR Code width | ||
| | ||
*/ | ||
'logoSize' => null, | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| QR Code Size | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Defines the default size for the generated qrcode. | ||
| | ||
*/ | ||
'background' => [ | ||
'r' => 255, | ||
'g' => 255, | ||
'b' => 255, | ||
], | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| QR Code Size | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Defines the default size for the generated qrcode. | ||
| | ||
*/ | ||
'foreground' => [ | ||
'r' => 0, | ||
'g' => 0, | ||
'b' => 0, | ||
'a' => 100, | ||
], | ||
|
||
/* | ||
* ------------------------------------------------------------------------ | ||
* QR Code Label Style | ||
* | ||
* Defines the default style for the QR Code label style | ||
* ------------------------------------------------------------------------ | ||
*/ | ||
'label' => [ | ||
'fontPath' => null, | ||
'size' => 16, | ||
'align' => \Da\QrCode\Enums\Label::ALIGN_CENTER, | ||
] | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
Laravel Blade Component | ||
---- | ||
|
||
This library realeases a blade component to make it easy to build qrcode with the Laravel Framework. | ||
|
||
Before get started, make sure you have the class `\Da\QrCode\Providers\QrCodeServiceProvider::class` | ||
listed on you config/app.php file, on providers section. | ||
|
||
```php | ||
[ | ||
... | ||
'providers' => [ | ||
... | ||
\Da\QrCode\Providers\QrCodeServiceProvider::class, | ||
], | ||
]; | ||
``` | ||
|
||
With the provider set, we can create a qrcode using the `2am-qrcode` blade component. | ||
It has only `content` as a required field. | ||
|
||
```html | ||
<x-2am-qrcode :content="'2am. Technologies'"/> | ||
``` | ||
|
||
We can also define the qrcode [format](../index.md#Formats). To do so, | ||
you must specify the `format` attribute with a constant from `\Da\QrCode\Enum\Format` and the `content` as an array, | ||
fulfilling the data for the designed format as specified in the format [docs]((../index.md#Formats)). | ||
|
||
To work with colors (background, foreground and gradient foreground), you set | ||
the attributes `background`, `foregroud` and `foreground2` (for gradient foreground) as an array | ||
having the keys `r`, `g`, `b` (and `a` to set alpha on foreground, but it's optional). | ||
|
||
```php | ||
$background = [ | ||
'r' => 200, | ||
'g' => 200, | ||
'b' => 200, | ||
]; | ||
|
||
$foreground = [ | ||
'r' => 0, | ||
'b' => 255, | ||
'g' => 0, | ||
]; | ||
|
||
$foreground2 = [ | ||
'r' => 0, | ||
'b' => 0, | ||
'g' => 255, | ||
]; | ||
|
||
$content = [ | ||
'title' => '2am. Technologies', | ||
'url' => 'https://2am.tech', | ||
]; | ||
``` | ||
|
||
```html | ||
<x-2am-qrcode | ||
:content="$content" | ||
:format="\Da\QrCode\Enums\Format::BOOK_MARK" | ||
:background="$background" | ||
:foreground="$foreground" | ||
:foreground2="$foreground2" | ||
/> | ||
``` | ||
|
||
All blade component attributes: | ||
|
||
| Attribute | Description | Data Type | | ||
|:---------:|:--------------------------------------------------------------------------:|:----------------------------------------------:| | ||
| content | Defines the qrcode's data | string; array | | ||
| format | Defines the qrcode's format | \Da\QrCode\Enum\Format | | ||
| foreground | Defines the qrcode`s foreground base color | array (r, g, b, a) | | ||
| background | Defines the qrcode's background color | array (r, g, b, a) | | ||
| foreground2 | Defines the qrcode's foreground end color (turns to gradient) | array (r, g, b, a) | | ||
| pathStyle | Defines the qrcode's path style | \Da\QrCode\Enum\Path | | ||
| intensity | Defines the path style intensity | float, from 0.1 to 1 | | ||
| margin | Defines the qrcode's margin | int | | ||
| size | Defines the qrcode's size | int | | ||
| logoPath | Set a image to be displayed in the qrcode's center | string; it should be full path | | ||
| logoSize | Set the qrcode's logo size. | int. Recomended size is 16% from qrcode's size | | ||
| scaleLogoHeight | Set if the logo's image should be scaled instead of croped to square shape | bool. Default is false | | ||
| gradientType | Defines the gradient type | \Da\QrCode\Enums\Gradient | | ||
| label | Defines the qrcode's label | string | | ||
| font | Defines the label font | string. It should be full path | | ||
| fontSize | Defines the label font size | int | | ||
| fontAlign | Defines the label alignment | \Da\QrCode\Label | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Laravel Blade Component | ||
---- | ||
|
||
You can publish the qrcode's config file by executing the given command: | ||
|
||
```bash | ||
$ php artisan vendor:publish --tag=2am-qrcode-config | ||
``` | ||
|
||
This will create a file name 2am-qrcode.php under your config folder, where you can | ||
set the default look of your qrcode and the component prefix. | ||
|
||
By the next command, you can publish the component related view, enabling you to perform your | ||
own customization to component structure. | ||
|
||
```bash | ||
$ php artisan vendor:publish --tag=2am-qrcode-views | ||
``` |
Oops, something went wrong.