QR Code Generator v1.0.1

Quick Start Guide

webpatser@dev: ~/qr-code/1.0.1 $ cat quick-start.md

Quick Start - QR Code Generator v1.0.1

Get started with high-performance QR code generation in minutes. This guide covers the most common use cases with live examples.

Basic QR Code Generation

The most common QR codes you'll need:

 
use QR_Code\Types\QR_Text;
use QR_Code\Types\QR_Url;
 
// Simple text QR code
$textQR = new QR_Text('Hello, World!');
echo $textQR->png(); // PNG binary data
 
// URL QR code
$urlQR = new QR_Url('https://github.com/webpatser/qr-code');
echo $urlQR->svg(); // SVG string

Live Generation Comparison

Text QR Code

Text QR Code

Simple text encoding

URL QR Code

URL QR Code

Optimized URL format

Output Formats

Generate QR codes in multiple formats:

 
use QR_Code\Types\QR_Text;
 
$qr = new QR_Text('Sample Text');
 
// Different output formats
$pngData = $qr->png(); // PNG binary data
$svgString = $qr->svg(); // SVG as string
$epsString = $qr->eps(); // EPS PostScript
 
// Custom size
$qr->setSize(8); // Larger size
$largePng = $qr->png(); // Larger QR code
 
$qr->setSize(2); // Smaller size
$smallPng = $qr->png(); // Smaller QR code

QR Code Types

Type Method Use Case Example
Text QR_Text General purpose ✓ Text QR
URL QR_Url Website links ✓ URL QR
Email QR_EmailMessage Contact forms Email QR

Advanced QR Codes

Create specialized QR codes with additional data:

 
use QR_Code\Types\QR_EmailMessage;
use QR_Code\Types\QR_Phone;
use QR_Code\Types\QR_Sms;
use QR_Code\Types\QR_WiFi;
use QR_Code\Types\QR_Text;
 
// Email with subject and body
$email = new QR_EmailMessage('[email protected]', 'Message body', 'Hello');
 
// Phone number
$phone = new QR_Phone('+1-555-123-4567');
 
// SMS with message
$sms = new QR_Sms('+1-555-123-4567', 'Hello from QR code!');
 
// WiFi network credentials
$wifi = new QR_WiFi('NetworkName', 'password123', 'WPA');
 
// Geographic coordinates (as text)
$geo = new QR_Text('geo:40.7128,-74.0060'); // New York coordinates

Live Advanced Examples

Email
Advanced Email QR
Phone
Phone QR
WiFi
WiFi QR
Location
Geo QR

Performance Tips

  • Use caching: 3300x performance boost with built-in cache
  • Choose the right format: SVG for scalability, PNG for compatibility
  • Optimize size: Smaller QR codes scan faster
  • ImageMagick: Install for better performance and quality
 
// Enable caching for massive performance boost
QR_Code\QR_Code::enableCache();
 
// Efficient batch generation
$qrCodes = [];
foreach ($urls as $url) {
$qrCodes[] = QR_Code::url($url)->png();
}
 
// Benchmark generation speed
$start = microtime(true);
for ($i = 0; $i < 100; $i++) {
QR_Code::text("Sample $i")->png();
}
$time = (microtime(true) - $start) * 1000;
echo "Generated 100 QR codes in {$time}ms";

Next Steps