承接 akira/laravel-qrcode 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

akira/laravel-qrcode

Composer 安装命令:

composer require akira/laravel-qrcode

包简介

A clean, modern, and easy-to-use QR code generator for Laravel

README 文档

README

img.png

Latest Version on Packagist Tests PHPStan Total Downloads

A clean, modern, and easy-to-use QR code generator for Laravel applications. Built with the Action Pattern, Value Objects, and full type safety.

Features

  • Multiple output formats (PNG, SVG, EPS, WebP, PDF)
  • Highly customizable (colors, gradients, styles, sizes)
  • Specialized data types (WiFi, Email, vCard, Calendar, Phone, SMS, Geo, Bitcoin, Ethereum, Litecoin)
  • Logo/image merging support (from a file path or string content)
  • Built-in cache-backed generation and batch generation
  • Artisan command (qrcode:generate) with CSV batch mode
  • Type-safe with PHP 8.4+
  • PHPStan Level 9 compliant with 100% type coverage
  • Comprehensive test coverage

Requirements

  • PHP 8.4+
  • GD extension
  • Imagick extension for PNG, WebP, and PDF output
  • Laravel 12.0+

Installation

Install via Composer:

composer require akira/laravel-qrcode

Optionally, publish the configuration:

php artisan vendor:publish --tag="qrcode-config"

Quick Start

use Akira\QrCode\Facades\QrCode;

// Simple text
$qrCode = QrCode::text('Hello World');

// With customization
$qrCode = QrCode::size(300)
    ->color(255, 0, 0)
    ->text('https://example.com');

// WiFi network
$qrCode = QrCode::wifi([
    'ssid' => 'MyNetwork',
    'password' => 'secret123'
]);

// Email
$qrCode = QrCode::email('contact@example.com', 'Subject', 'Body');

// Contact card
$qrCode = QrCode::vcard([
    'fullName' => 'Jane Doe',
    'email' => 'jane@example.com'
]);

// Calendar event
$qrCode = QrCode::ical([
    'summary' => 'Release planning',
    'startsAt' => '2026-06-01 10:00:00 UTC',
    'endsAt' => '2026-06-01 11:00:00 UTC'
]);

// Phone
$qrCode = QrCode::phone('+1234567890');

// Ethereum
$qrCode = QrCode::ethereum(
    '0x0000000000000000000000000000000000000001',
    '1000000000000000000'
);

// Litecoin
$qrCode = QrCode::litecoin('ltcaddress', 1.25);

// With styling
$qrCode = QrCode::size(400)
    ->gradient(255, 0, 0, 0, 0, 255, 'diagonal')
    ->style('round', 0.7)
    ->eye('circle')
    ->text('Styled QR Code');

Documentation

Browse the full documentation in docs/, or on the package website: https://packages.akira-io.com/packages/laravel-qrcode

Highlights: Installation - Configuration - Data Types - Customization - API Reference - Command Line

Available Data Types

Type Description Example
WiFi Network credentials QrCode::wifi(['ssid' => 'Network', 'password' => 'pass'])
Email mailto links QrCode::email('email@example.com', 'Subject', 'Body')
vCard Contact cards QrCode::vcard(['fullName' => 'Jane Doe'])
Calendar VEVENT calendar entries QrCode::ical(['summary' => 'Meeting', 'startsAt' => '2026-06-01 10:00:00 UTC', 'endsAt' => '2026-06-01 11:00:00 UTC'])
Phone Direct dial QrCode::phone('+1234567890')
SMS Pre-filled message QrCode::sms('+1234567890', 'Hello')
Geo GPS coordinates QrCode::geo(37.7749, -122.4194, 'San Francisco')
Bitcoin Payment address QrCode::bitcoin('address', 0.001, ['label' => 'Donation'])
Ethereum Payment address QrCode::ethereum('0x...', '1000000000000000000', ['chainId' => 1])
Litecoin Payment address QrCode::litecoin('address', 1.25, ['label' => 'Donation'])

Customization Options

Option Description Values
Size Dimensions in pixels size(300)
Colors Foreground/background color(r, g, b), backgroundColor(r, g, b)
Gradients Color transitions gradient(r1, g1, b1, r2, g2, b2, 'type')
Styles Module shapes style('square|dot|round', 0-1)
Eyes Pattern styles eye('square|circle'), eyeColor(...)
Error Correction Data recovery errorCorrection('L|M|Q|H')
Formats Output type format('png|svg|eps|webp|pdf')
Logo Image merging merge('/path/to/logo.png', 0.2)

Usage Examples

In Blade Templates

{!! QrCode::format('png')->generate('https://example.com') !!}

API Response

return response()->json([
    'qrcode' => base64_encode(QrCode::format('png')->generateRaw($data))
]);

Download Response

$png = QrCode::format('png')->size(500)->generateRaw($data);

return response($png)
    ->header('Content-Type', 'image/png')
    ->header('Content-Disposition', 'attachment; filename="qrcode.png"');

With Logo

$qrCode = QrCode::format('png')
    ->size(400)
    ->errorCorrection('H')
    ->merge(public_path('logo.png'), 0.2)
    ->text('https://example.com');

Testing

# Run code quality checks and tests
composer test

# Run code style fixer
composer lint

Architecture

This package is built with:

  • Action Pattern - Single-responsibility business logic
  • Value Objects - Immutable, validated data structures
  • Dependency Injection - Laravel IoC container
  • Type Safety - PHP 8.4+ with readonly classes
  • SOLID Principles - Clean, maintainable code

See Architecture Documentation for details.

Contributing

Contributions are welcome! Please see Contributing Guide for details.

Security

If you discover any security issues, please email kidiatoliny@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Links

akira/laravel-qrcode 适用场景与选型建议

akira/laravel-qrcode 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.47k 次下载、GitHub Stars 达 49, 最近一次更新时间为 2025 年 11 月 10 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「generator」 「qrcode」 「laravel」 「qr」 「akira」 「bacon」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 akira/laravel-qrcode 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 akira/laravel-qrcode 我们能提供哪些服务?
定制开发 / 二次开发

基于 akira/laravel-qrcode 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 4.47k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 49
  • 点击次数: 14
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 49
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-11-10