定制 dgvai/laravel-invoicer 二次开发

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

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

dgvai/laravel-invoicer

Composer 安装命令:

composer require dgvai/laravel-invoicer

包简介

Invoice Management Package For Laravel

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version License Monthly Downloads Daily Downloads composer.lock

This package is built for Invoice Management and Generation for Laravel 5.5+, 6.x, 7.x (not tested for lower versions)

Contents

Installation

You can install the package via composer:

    composer require dgvai/laravel-invoicer

Publish Configuration

Publish configuration file

    php artisan vendor:publish --provider="DGvai\Invoicer\InvoicerServiceProvider"

Setup and configure

You can update your app environment (.env) (If needed). The environment Values are all your choice. Peek a look at config/invoicer.php

Configure your configuration file, the required details for the values are documentated as commented in config/invoicer.php file.

After done configuraing

    php artisan config:cache

Usage

Generate Invoice

From your controller:

use DGvai\Invoicer\Invoicer;
use App\Http\Controllers\Controller;

class InvoiceController extends Controller
{
    public function show()
    {

        $invoice = new Invoicer();
        $invoice->setupInvoice('#HDG-4657F-DH8')
                ->setBuyer('John Doe','email@email.com','0100001000')
                ->setShippingAddr('0/3B Abul Tabul Conference Road, DG Street, China');

        $invoice->addItem('Lorem Ipsum Product Name 1',3.5,'Pc',230.5,20)
                ->addItem('Lorem Ipsum Product Name 2',3,'Kg',120.33,10.2,60)
                ->addItem('Bigger Abul Tabul Product Name This Time',1,'Pc',550.52,10,10);

        $invoice->setPaymentState('UNPAID','important','Pay before 24-02-2020');

        $pdf = $invoice->generate();

        if($pdf->success)
        {
            return $pdf->filename;
        }
    }
}

NOTE This is the minimalist basic need to generate invoice PDF.
Example PDF Have look at this example pdf generated.
Example PDF (v2) Have look at this advanced example (v2) pdf generated.

Available Methods

Setup Invoice

Description: Setup the invoice.

    setupInvoice($invoice_no, $issue_date = null)

Params
required Invoice No : string
optional Issue Date : string : By default it will take current date.

Setup Buyer Informations

Description: Set the buyer/user information.

    setBuyer($name, $email, $phone = null)

Params
required Buyer Name : string
required Buyer Email : string
optional Buyer Phone : string

Set Shipping Address

Description: Set the buyer/user shipping address.

    setShippingAddr($address)

Params
required Buyer Shipping Address : string

Set Shipping Cost

Description: Set the buyer/user shipping cost.

    setShippingCost($cost)

Params
required Buyer Shipping Cost : numeric

Set Home Delivery Cost

Description: Set the buyer/user Home Delivery cost.

    setHomeDeliveryCost($cost)

Params
required Buyer Home Delivery Cost : numeric

Add Items

Description: Add the items buyer/user bought, eg. from cart or order history.

    addItem($title, $qty, $unit, $unit_price, $discount, $extra_cost = 0, $additional_shipping = 0)

Params
required Item Title : string
required Item Quantity : integer/float
required Item Unit : string : eg. Pc/Kg/Plate...
required Item Unit Price : decimal
required Item Discount : decimal
optional Item Extra Cost : decimal
optional Item Additional Shipping Cost : decimal

Apply Coupon Discount

Description: Apply coupon discount to your orders invoice.

    applyCoupon($code, $discount)

Params
required Coupon Code : string
required Coupon Discount : integer/float

Set Payment State

Description: Set the payment state of the invoice. Also add some notes.

    setPaymentState($state, $label='info', $additional=null)

Params
required State : string : eg. PAID, UNPAID, PENDING...
optional Label : enums : [success/important/warning]
optional Additional : string : Additional note on payment to show

Generate

Description: Generate the Invoice PDF.

    generate($path_to_save=null)

Params
optional Path/to/filename.pdf : string : The full path of saving with filename. By default it will save on public/invoices path.

Changelog

Please see CHANGELOG for more information what has changed recently.

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-04-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固