定制 smarterp-dev/pdf-template 二次开发

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

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

smarterp-dev/pdf-template

最新稳定版本:v1.0.24

Composer 安装命令:

composer require smarterp-dev/pdf-template

包简介

A Laravel package for creating PDF documents using mPDF with Khmer language support

README 文档

README

PHP Tests

PDF Template Package

A Laravel package for generating PDF documents using mPDF with Khmer font support and custom templates.

Project Setup

Prerequisites

Before running tests or using the package, ensure you have:

  1. Installed all dependencies:

    composer install
  2. Created the required temporary directory for mPDF:

    mkdir -p temp/pdf

Running Tests

You can run the test suite using any of these methods:

  • Using Composer script (recommended):

    composer test
  • Running PHPUnit directly:

    vendor/bin/phpunit
  • Running specific test suite:

    vendor/bin/phpunit --testsuite=Unit
  • Running a specific test file:

    vendor/bin/phpunit tests/Unit/TemplateTest.php
  • Running a specific test method:

    vendor/bin/phpunit --filter=it_can_get_config_with_default_values

Test Coverage Report

To generate an HTML test coverage report, run:

composer test-coverage

This will create HTML reports in the coverage directory.

Continuous Integration

GitHub Actions workflow in .github/workflows/run-tests.yml automatically runs tests across multiple PHP and Laravel versions on push or pull request.

Extending Tests

When adding new features, please add corresponding tests in:

  • Unit tests: tests/Unit/

Installation

You can install the PDF Template package via Packagist:

1. Require the package via Composer

Run the following command in your project root:

composer require smarterp-dev/pdf-template

2. Publish the package views (optional)

If you want to customize the PDF templates, you can publish the package's views to your Laravel application's resources directory:

php artisan vendor:publish --tag=views

This will copy the package views to resources/views/vendor/smarterp-dev.

To publish only the template views:

php artisan vendor:publish --tag=view-templates

This will copy the template views to resources/views/vendor/smarterp-dev/templates.

To publish example template views:

php artisan vendor:publish --tag=view-examples

This will copy example templates to resources/views/vendor/smarterp-dev/templates/examples.

3. Create the required temporary directory for mPDF

mPDF requires a writable temporary directory. Create it with:

mkdir -p temp/pdf

4. Configuration

The package will automatically register its service provider. No manual configuration is required for basic usage.

5. Ready to Use

You can now use the package in your Laravel application. For usage examples and API documentation, refer to docs/pdf.md and docs/template.md

License

MIT License. See LICENSE

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-05-12