snono/report-builder

由snono systems为laravel设计生成PDF报告

dev-master 2018-11-19 19:27 UTC

This package is not auto-updated.

Last update: 2024-10-02 23:17:45 UTC


README

为laravel生成类似于(发票、收据)的PDF报告

要求

* "php >= 5.4.0
* ext-gd
* ext-dom
* ext-mbstring
* phenx/php-font-lib
* phenx/php-svg-lib
* ext-bcmath
* illuminate/support
* illuminate/view
* nesbot/carbon

使用composer安装

composer require snono/report-builder

发布配置

php artisan vendor:publish --tag=report-bulder

示例用法:首先你需要添加导入类ReportBuilder

use Snono\ReportBuilder\Builder\Classes\ReportBuilder;

请参阅以下示例代码

$invoice = ReportBuilder::make()
            ->template('default')
            ->language('ar')  
            ->currency('IQD')
            ->orientation('portrait')
            ->isRTL(false)
            ->addItem('ماتزال تداعيات التقييم الذي أصدرته وكالة ', 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 4', 1.25, 1, 923)
            ->addItem('Test Item 4', 1.25, 1, 923)
            ->addItem('Test Item 4', 1.25, 1, 923)
            ->addItem('Test Item 4', 1.25, 1, 923)
            ->number(4021)
            ->tax(21)
            ->notes('Lrem ipsum dolor sit amet, consectetur adipiscing elit.')
            ->customer([
                        'name' => 'Èrik Campobadal Forés',
            'id' => '12345678A',
            'phone' => '+34 123 456 789',
            'location' => 'C / Unknown Street 1st',
            'zip' => '08241',
            'city' => 'Manresa',
            'country' => 'Spain',
            ])
            ->download('demo');
注意

需要bcmath PHP扩展,请通过命令检查你的PHP版本

php -v
sudo apt install php7.2-bcmath