tiime / cross-industry-invoice
0.2.4
2023-11-24 09:22 UTC
Requires
- php: ^8.1
- ext-dom: *
- ext-libxml: *
- tiime/en-16931: ^0.9
- twig/intl-extra: ^3.6
- twig/twig: ^3.6
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.16
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^10.1
README
如何在 Symfony 中添加此库?
下载此库
composer require tiime/cross-industry-invoice
如果您想使用位于 src/Resources/views/
文件夹中的模板,您需要添加以下配置:
twig: # ... paths: '%kernel.project_dir%/vendor/tiime/cross-industry-invoice/src/Resources/views/': 'TiimeCII'
如果您想使用此库中的模板,还需要下载 twig/extra-bundle
包
composer require twig/extra-bundle
在 config/services.yaml
中添加以下配置:
Tiime\CrossIndustryInvoice\Renderer\TwigRenderer: arguments: $environment: '@twig' Tiime\CrossIndustryInvoice\Renderer\CrossIndustryInvoiceRendererInterface: '@Tiime\CrossIndustryInvoice\Renderer\TwigRenderer'
如何使用它?
use Tiime\CrossIndustryInvoice\EN16931\CrossIndustryInvoice; use Tiime\CrossIndustryInvoice\Renderer\CrossIndustryInvoiceRendererInterface; class MyService { public function __construct(private readonly CrossIndustryInvoiceRendererInterface $renderer) { } public function doSomething() { // Create CrossIndustryInvoice object with needed parameters $crossIndustryInvoice = new CrossIndustryInvoice(...); $this->renderer->render($crossIndustryInvoice, '@TiimeCII/en16931_invoice.html.twig') } }