You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+83-25Lines changed: 83 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,19 +1,49 @@
1
1
# HeroQR Library
2
2
3
-
HeroQR is an advanced and modular PHP library designed to simplify the creation, customization, and management of QR codes. Whether you need a basic QR code or a highly customized one with embedded logos and colors, HeroQR has you covered.
3
+
HeroQR is an advanced and modular PHP library designed to simplify the creation, customization, and management of QR codes. Whether you need a basic QR code or a highly customized one with embedded logos, colors, markers, and cursors, HeroQR has you covered. You can fully customize the appearance of your QR code by adjusting the markers (for corner customization) and cursors (for design enhancements). This level of customization allows you to tailor your QR codes to fit your needs precisely.
- Add labels with customizable color, size, text alignment, and margin.
10
-
- Support for various encoding formats such as UTF-8 and other standard formats.
11
-
- Change the color of the QR code along with the background color.
26
+
- Support for various encoding formats such as BASE64, UTF-8, UTF-16, and other standard formats.
27
+
- Change the color of the QR code along with the background color, with the ability to adjust the transparency of the colors.
12
28
- Automatically adjust the QR code layout and margin.
13
29
14
-
-**Multi-Format Data Encoding :** Effortlessly encode URLs, text, emails, business cards, and payment information.
30
+
-**Customizable Markers and Cursors :** HeroQR allows you to customize the QR code markers and cursors, giving you enhanced control over the design. This feature is available exclusively for PNG output. To customize the markers and cursors, use generate('png-M1-C1'), where:
31
+
32
+
-`M1` specifies the marker type.
33
+
-`C1` specifies the cursor type.
34
+
- Available marker and cursor types:
35
+
-**Markers :**`M1``M2``M3`
36
+
-**Cursors :**`C1``C2``C3`
37
+
38
+
-**Note** : This feature is currently limited to PNG format due to its advanced rendering capabilities, but support for other formats will be available in future releases.
39
+
40
+
41
+
-**Multi-Format Data Encoding :** Easily encode various data types, including URLs, text, emails, business cards, and payment information, providing versatility for your QR code needs.
42
+
15
43
-**Data Validation :** The library supports validation for various data types, including URL, text, email, phone number, IP, and Wi-Fi, ensuring the accuracy of input data.
16
-
-**Flexible Export Options :** Save QR codes in multiple formats, including PDF, SVG, PNG, Binary, GIF, EPS, and WebP, ensuring compatibility with different projects.
44
+
45
+
-**Flexible Export Options :** Save QR codes in multiple formats, including PDF, SVG, PNG, Binary, GIF, EPS, and WebP. If you don't require custom markers or cursors, you can choose from these formats for your output.
46
+
-
17
47
-**Framework Ready :** Seamlessly integrates with frameworks like Laravel, making it a perfect fit for modern applications.
Generate a simple QR code in just a few lines of code:
62
+
-Generate a simple QR code in just a few lines of code:
33
63
34
64
#### Example :
35
65
@@ -43,8 +73,8 @@ $qrCodeManager = new QRCodeGenerator();
43
73
$qrCode = $qrCodeManager
44
74
# Set the data to be encoded in the QR code
45
75
->setData('https://test.org')
46
-
# Generate the QR code in PNG format
47
-
->generate('png') ;
76
+
# Generate the QR code in PNG format (default)
77
+
->generate() ;
48
78
49
79
# Save the generated QR code to a file named 'qrcode.png'
50
80
$qrCode->saveTo('qrcode');
@@ -54,8 +84,8 @@ $qrCode->saveTo('qrcode');
54
84
55
85
**Fully customize the appearance and functionality of your QR code while ensuring data validation:**
56
86
57
-
-**Customization Options**: You can modify various parameters such as size, color, logo, and other visual aspects.
58
-
-**Automatic Data Validation**: By using `DataType` (optional), the library automatically validates the type of data being encoded (Url, Email, Phone, Location, Wifi , Text).
87
+
-**Customization Options :** You can modify various parameters such as size, color, logo, and other visual aspects.
88
+
-**Automatic Data Validation :** By using `DataType` (optional), the library automatically validates the type of data being encoded (Url, Email, Phone, Location, Wifi , Text).
With these options, you can create visually appealing QR codes that align with your design needs.
102
132
103
-
### 3. Advanced Output Options
133
+
### 3. Customizing Markers and Cursors (PNG Only)
134
+
135
+
- HeroQR allows you to customize the markers and cursors of the QR code. This feature is exclusive to PNG output, and you must specify the output format using generate('png-M1-C1'), where M1 is the marker type and C1 is the cursor type. Currently, only the following options are available:
136
+
-**Markers :**`M1`, `M2`, `M3`
137
+
-**Cursors :**`C1`, `C2`, `C3`
138
+
139
+
#### Example :
140
+
141
+
```php
142
+
use HeroQR\Core\QRCodeGenerator;
104
143
105
-
HeroQR supports advanced output options for greater flexibility when generating QR codes:
144
+
$qrCode = $qrCodeManager
145
+
->setData('https://example.com')
146
+
->setSize(800)
147
+
->setBackgroundColor('#ffffffFF')
148
+
->setColor('#000000')
149
+
# Customize the markers and Cursors (M1 for marker, C1 for Cursor)
150
+
->generate('png-M1-C1');
151
+
152
+
# Save the generated QR code with custom markers and Cursors
153
+
$qrCode->saveTo('custom-markers-qr');
154
+
```
155
+
-**Example Output :** The following images showcase QR codes generated with different marker and cursor configurations in this order : ['M1-C1', 'M2-C2', 'M3-C3'].
106
156
107
-
-**Matrix Output** : Represent the QR code as a matrix (2D array) of bits, where each block of the matrix corresponds to a specific piece of the encoded data. You can retrieve the matrix in two forms:
HeroQR provides advanced output capabilities, offering flexibility and compatibility for various use cases, from web embedding to raw data manipulation:
164
+
-**Matrix Output :** Represent the QR code as a matrix (2D array) of bits, where each block of the matrix corresponds to a specific piece of the encoded data. You can retrieve the matrix in two forms:
108
165
- As a `Matrix` object.
109
166
- As a 2D array, which makes it easier to manipulate or display directly in some applications.
110
167
111
-
-**Base64 Encoding** : Generate the QR code as a Base64-encoded string, which is ideal for embedding directly in HTML, emails, or other media.
168
+
-**Base64 Encoding :** Generate the QR code as a Base64-encoded string, which is ideal for embedding directly in HTML, emails, or other media.
112
169
113
-
-**Data URI** : Get the QR code as a Data URI, which is a compact string representation of the image that can be embedded directly into HTML.
170
+
-**Data URI :** Get the QR code as a Data URI, which is a compact string representation of the image that can be embedded directly into HTML.
114
171
115
-
-**Saving to Different Formats** : You can save the QR code in a variety of formats such as PNG, SVG, GIF, WebP, EPS, PDF, Binary, and more. The format is automatically determined based on the desired output type.
172
+
-**Saving to Different Formats :** You can save the QR code in a variety of formats such as PNG, SVG, GIF, WebP, EPS, PDF, Binary, and more. The format is automatically determined based on the desired output type.
The modular structure of HeroQR ensures ease of use and scalability:
140
196
141
-
-**Contracts :** Defines interfaces for the core components, ensuring consistency across the system.
142
-
-**Core :** Contains the main logic for generating and managing QR codes.
143
-
-**DataTypes :** Handles definitions for the various types of data (Location, Url, Email, Phone, Text) and performs automatic validation for each type, so users don’t need to validate data manually.
144
-
-**Managers :** Manages the customization and processing of QR codes, providing maximum flexibility for users.
197
+
- The modular structure of HeroQR is designed to enhance efficiency and scalability, making it easier to use, maintain, and expand:
198
+
199
+
-**Contracts :** Defines interfaces for the core components, ensuring consistency and reusability across the system.
200
+
-**Core :** Houses the primary logic for generating and managing QR codes, acting as the foundation of the library.
201
+
-**DataTypes :** Provides definitions and automatic validation for various data types (wifi, Location, URL, Email, Phone, Text). This eliminates the need for users to manually validate their input.
202
+
-**Managers :** Oversees the customization and processing of QR codes, enabling users to have full control over the appearance and functionality of their QR codes.
203
+
-**Customs :** The Customs module allows advanced QR code customization, including cursors, markers, line colors, and other visual elements, perfect for creating unique and tailored designs.
145
204
146
205
## Contributing
147
206
@@ -159,11 +218,10 @@ HeroQR is released under the [MIT License](LICENSE), giving you the freedom to u
159
218
160
219
## Contact
161
220
162
-
Have questions or suggestions? Let’s connect:
163
-
221
+
For inquiries or feedback, feel free to reach out via email or GitHub issues :
0 commit comments