定制 thirtybittech/invoicematic 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

thirtybittech/invoicematic

Composer 安装命令:

composer require thirtybittech/invoicematic

包简介

A Statamic addon for generating professional PDF invoices with dynamic content and seamless CMS integration.

README 文档

README

Invoicematic is a professional-grade, paid Statamic addon that automatically generates beautiful, PDF-based invoices when entries are created in your collections (e.g., orders, registrations, bookings).

Built with flexibility, configurability, and real-world invoicing needs in mind.

⚡️ Quick Setup

  1. Install:

    composer require thirtybittech/invoicematic
  2. Generate blueprint (optional):

    php artisan invoicematic:setup-collection orders
  3. Use:

    • Create a new entry in your collection
    • Invoice PDF auto-generated (and emailed if configured)

🚀 Features

  • 📄 Automatically generate PDF invoices from collection entries
  • 📧 Optionally email the PDF invoice to the customer (SMTP required)
  • 🛠 Artisan command to auto-generate a collection blueprint for orders
  • 🎨 Customizable Blade templates with full HTML/CSS control for both invoice & email template
  • 🔁 Supports multiple collections with independent field mapping
  • 🔒 Prevents duplicate generation with smart toggles
  • 💾 Auto-saves PDFs to your storage (configurable path)
  • 🧠 Dynamic field mapping — no hardcoded field handles
  • 💰 Built-in currency formatting support
  • 🧍 Customizable company/sender details
  • Fully Statamic-native; no external dependencies required beyond DomPDF

💼 Use Cases

  • Ecommerce Order Invoices
  • Event Registration Receipts
  • Booking Confirmations
  • Donation Receipts

💸 Paid Addon Notice

This is a commercial addon. A valid license is required to use it in production.

To obtain a license, visit Statamic Addone or contact contact@30-bit.com.

📦 Installation

composer require thirtybittech/invoicematic

Publish the config:

php artisan vendor:publish --tag=invoicematic-config

Optionally publish the default Blade template:

php artisan vendor:publish --tag=invoicematic-views

After publishing, you can customize the templates under:

  • resources/views/vendor/invoicematic/templates/default.blade.php (for invoices)
  • resources/views/vendor/invoicematic/emails/invoice.blade.php (for emails)

To use custom templates, update the templates and email_template keys in config/invoicematic.php accordingly.

⚙️ Configuration

Edit config/invoicematic.php:

🗺 Field Aliases (Flexible Mapping)

Configure how your fields map to canonical invoice fields:

'field_aliases' => [
    'orders' => [

        // Required fields
        'order_number'    => ['order_number','order_id', 'id'],
        'customer_name'   => ['customer_name','client_name', 'name'],
        'customer_email'  => ['customer_email','email', 'contact_email'],
        'items'           => ['items', 'products', 'line_items'],
        'item_fields' => [
            'name'     => ['name', 'product_name', 'title'],
            'quantity' => ['quantity', 'qty', 'amount'],
            'price'    => ['price', 'unit_price', 'cost'],
        ],
        'total'     => ['total','amount', 'grand_total'],
        'currency'        => ['currency','currency_code'],

        // Optional metadata
        'tax'       => ['tax', 'vat_amount'],
        'subtotal'  => ['subtotal'],
        'paid'            => ['paid' , 'is_paid', 'payment_status'],
        'date'            => ['date' ,'order_date', 'created_at'],
        'note'          => ['notes', 'message', 'comment'], 
    ],

],

You can define multiple collections (orders, registrations, etc.) with their own mappings.

🏢 Company Info

Used across all invoices:

'company' => [
    'name' => 'Your Company Name',
    'address' => [
        'line1' => '123 Business Rd',
        'line2' => null,
        'city' => 'City',
        'country' => 'Country',
    ],
    'email' => 'email@company.com',
    'footer_message' => 'Thank you for your business',
    'company_logo' => null, 
],

💾 Storage & Filename

'storage_path' => storage_path('app/invoices'),
'filename_format' => '{collection}_{order_number}.pdf',

Filenames are automatically made unique by the system.

💱 Currency Formatting

'currency' => [
    'default' => 'USD',
    'format' => [
        'USD' => ['symbol' => '$', 'decimal' => 2],
        'EUR' => ['symbol' => '', 'decimal' => 2],
    ],
],

🧠 How It Works

  1. User creates a new entry in a configured collection (e.g., orders)

  2. Event is triggered

  3. If invoice hasn't been generated:

    • Fields are resolved based on alias config

    • PDF is created & saved to storage

    • Optionally is sent to the user with invoice

    • Entry is updated with:

      • invoice_generated = true
      • invoice_path = /path/to/invoice.pdf

🧪 Testing

You can manually test by:

  • Creating an entry in the target collection
  • Verifying that the PDF is saved under storage_path
  • Ensuring invoice_generated and invoice_path fields are set on the entry

🔧 Artisan Commands

Generate Order Collection Blueprint

You can quickly scaffold a blueprint for an orders collection using:

php artisan invoicematic:setup-collection orders

This generates a blueprint with the necessary fields (order_number, customer_name, items, etc.).

🛠 Requirements

  • PHP 8.1+
  • Statamic 5.x
  • SMTP configured (for emailing invoices. Optional)

Limitations

  • This addon does not calculate values such as subtotal, total, or tax.
  • All values will be used as-is in the entry; they must be pre-calculated before being passed to the addon.

📩 Support

Need help or a custom integration? Contact contact@30-bit.com

📝 License

This is a paid addon. Redistribution or use without a valid license is prohibited.

thirtybittech/invoicematic 适用场景与选型建议

thirtybittech/invoicematic 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 06 月 18 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 thirtybittech/invoicematic 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 5
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 11
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-06-18