- How do I install Quar in a Laravel 11 project?
- Run `composer require tuncaybahadir/quar` in your project root. No additional configuration is needed—Quar integrates seamlessly with Laravel’s service container and facades. Ensure your project meets the minimum requirements: PHP 8.2+ and Laravel 10+.
- Can I generate QR codes dynamically for user-specific links?
- Yes, Quar supports dynamic content. Use the fluent API in your controller (e.g., `Quar::generate($user->token)->size(300)`) and pass the result to Blade. For high-traffic apps, cache the generated QR codes using Laravel’s `Cache::remember` to avoid regenerating on every request.
- What Laravel versions does Quar support?
- Quar is fully compatible with Laravel 10, 11, 12, and 13. It also supports PHP 8.2 through 8.5. The package is regularly updated to align with Laravel’s latest releases, ensuring backward compatibility.
- How do I customize the QR code’s eye/marker style?
- Use the `eye()` method with one of the supported styles: `square` (default), `rounded`, `circle`, or `ring`. For example, `Quar::eye('rounded')->generate('https://example.com')` will render a QR code with rounded detection markers.
- Is it possible to add a logo or text overlay to the QR code?
- Quar supports logos and text overlays via method chaining. For logos, use `logo($path)` and adjust margins with `margin(1)` to avoid alignment issues (due to upstream library limitations). Text overlays require version 1.6.0+ and can be configured with `configureText()`. Test Unicode or custom fonts in a staging environment first.
- Can Quar generate QR codes as base64 strings for APIs or PDFs?
- Yes, Quar returns QR codes in multiple formats. Use `Quar::generate()->getBase64()` to embed QR codes in emails, PDFs (via dompdf), or APIs. For Blade views, the default output is an inline SVG or HTML image tag, but you can also save QR codes to files using `storage_path()`.
- What are the performance implications of generating QR codes in production?
- Quar is synchronous, so generating large QR codes (e.g., `size(400)`) or batch processing may impact response times. For high-throughput systems, consider pre-generating QR codes and caching them. Alternatively, offload generation to Laravel queues for async processing.
- Are there any known issues with logo placement in Quar?
- Yes, the underlying Bacon/BaconQrCode library has a documented bug where logos may not align perfectly. Mitigate this by using `margin(1)` to add padding around the logo. For critical projects, test thoroughly or implement fallback logic (e.g., a static placeholder) if logo integration fails.
- How do I use Quar in a Dockerized Laravel application?
- Ensure the Docker container has write permissions for the `storage_path()` directory if saving QR codes as files. For file-based generation, verify the storage directory is mounted and writable in your Docker setup. Inline or base64 outputs (e.g., Blade or API responses) don’t require additional configuration.
- What alternatives to Quar exist for Laravel QR code generation?
- Alternatives include `simple-software/simple-qrcode` (standalone PHP) or `endroid/qr-code` (supports Laravel but lacks fluent API). Quar stands out for its Laravel-native design, fluent API, and built-in support for Blade views, colors, and markers. Choose Quar if you prioritize ease of use and Laravel integration.