solumdesignum/invoices 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

solumdesignum/invoices

Composer 安装命令:

composer require solumdesignum/invoices

包简介

Generate PDF invoices for your customers in laravel

README 文档

README

Total Downloads Latest Stable Version Latest Unstable Version MIT Licensed

Introduction

Invoices is a Laravel library that generates a PDF invoice for your customers. The PDF can be either downloaded or streamed in the browser. It's highly customizable, and you can modify the whole output view as well.

Installation

To get started, install using the composer package manager:

composer require solumdesignum/invoices

Next, publish resources using the vendor:publish command:

php artisan vendor:publish --provider="SolumDeSignum\Invoices\InvoicesServiceProvider"

This command will publish a config to your config directory, which will be created if it does not exist.

Invoices Features

The configuration file contains configurations.

<?php

declare(strict_types=1);

return [
    'templates' => [
        'default',
    ],

    /*
    |--------------------------------------------------------------------------
    | Default Currency
    |--------------------------------------------------------------------------
    |
    | This value is the default currency that is going to be used in invoices.
    | You can change it on each invoice individually.
    */

    'currency' => 'EUR',

    /*
    |--------------------------------------------------------------------------
    | Default Decimal Precision
    |--------------------------------------------------------------------------
    |
    | This value is the default decimal precision that is going to be used
    | to perform all the calculations.
    */

    'decimals' => 2,


    /*
    |--------------------------------------------------------------------------
    | Default Invoice Logo
    |--------------------------------------------------------------------------
    |
    | This value is the default invoice logo that is going to be used in invoices.
    | You can change it on each invoice individually.
    */

    'logo' => 'http://i.imgur.com/t9G3rFM.png',

    /*
    |--------------------------------------------------------------------------
    | Default Invoice Logo Height
    |--------------------------------------------------------------------------
    |
    | This value is the default invoice logo height that is going to be used in invoices.
    | You can change it on each invoice individually.
    */

    'logo_height' => 60,

    /*
    |--------------------------------------------------------------------------
    | Default Invoice Buissness Details
    |--------------------------------------------------------------------------
    |
    | This value is going to be the default attribute displayed in
    | the customer model.
    */

    'business_details' => [
        'name' => env('APP_NAME', 'My Company'),
        'id' => '1234567890',
        'phone' => '+34 123 456 789',
        'location' => 'Main Street 1st',
        'zip' => '08241',
        'city' => 'Barcelona',
        'country' => 'Spain',
    ],

    /*
    |--------------------------------------------------------------------------
    | Default Invoice Footnote
    |--------------------------------------------------------------------------
    |
    | This value is going to be at the end of the document, sometimes telling you
    | some copyright message or simple legal terms.
    */

    'footnote' => '',

    /*
    |--------------------------------------------------------------------------
    | Default Tax Rates
    |--------------------------------------------------------------------------
    |
    | This array group multiple tax rates.
    |
    | The tax type accepted values are: 'percentage' and 'fixed'.
    | The percentage type calculates the tax depending on the invoice price, and
    | the fixed type simply adds a fixed amount to the total price.
    | You can't mix percentage and fixed tax rates.
    */
    'tax_rates' => [
        [
            'name' => '',
            'tax' => 0,
            'tax_type' => 'percentage',
        ],
    ],

    /*
    | Default Invoice Due Date
    |--------------------------------------------------------------------------
    |
    | This value is the default due date that is going to be used in invoices.
    | You can change it on each invoice individually.
    | You can set it null to remove the due date on all invoices.
    */
    'due_date' => date('M dS ,Y', strtotime('+3 months')),

    /*
    | Default pagination parameter
    |--------------------------------------------------------------------------
    |
    | This value is the default pagination parameter.
    | If true and page count are higher than 1, pagination will show at the bottom.
    */
    'with_pagination' => true,

    /*
    | Duplicate header parameter
    |--------------------------------------------------------------------------
    |
    | This value is the default header parameter.
    | If true header will be duplicated on each page.
    */
    'duplicate_header' => false,

];

Sample Invoice

This is a sample invoice generated using this library:

Sample Invoice

$invoice = (new \SolumDeSignum\Invoices\Invoices())
                ->addItem('Test Item', 10.25, 2, "1412")
                ->addItem('Test Item 2', 5, 2, "923")
                ->addItem('Test Item 3', 15.55, 5, "42")
                ->addItem('Test Item 4', 1.25, 1, "923")
                ->addItem('Test Item 5', 3.12, 1, "3142")
                ->addItem('Test Item 6', 6.41, 3, "452")
                ->addItem('Test Item 7', 2.86, 1, "1526")
                ->addItem('Test Item 8', 5, 2, 923, 'https://dummyimage.com/64x64/000/fff')
                ->setNumber(4021)
                ->setWithPagination(true)
                ->setDuplicateHeader(true)
                ->setDueDate(Carbon::now()->addMonths(1))
                ->setNotes('Lrem ipsum dolor sit amet, consectetur adipiscing elit.')
                ->setCustomerDetails(
                    new Collection([
                        'name' => 'Oskars Germovs',
                        'id' => '12345678A',
                        'phone' => '+371 000 000 00',
                        'location' => 'C / Unknown Street 1st',
                        'zip' => '08241',
                        'city' => 'Manresa',
                        'country' => 'Spain',
                    ])
                )
                ->setBusinessDetails(
                    new Collection([
                        'id' => '123456789',
                        'name' => 'Solum DeSignum',
                        'phone' => '+371 000 000 00',
                        'location' => 'C / Unknown Street 1st',
                        'zip' => 'LV-1046',
                        'city' => 'Riga',
                        'country' => 'Latvia',
                    ])
                )
                ->download('demo')
                ->save('public/myinvoicename.pdf');

Author

License

Solum DeSignum Invoices is open-sourced software licensed under the MIT license.

Idea

This package is based on a package consoletvs/invoices.

solumdesignum/invoices 适用场景与选型建议

solumdesignum/invoices 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12 次下载、GitHub Stars 达 2, 最近一次更新时间为 2024 年 09 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 12
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 23
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 0
  • Forks: 129
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-09-08