定制 tecsiaron/ublrenderer 二次开发

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

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

tecsiaron/ublrenderer

最新稳定版本:0.0.1-alpha

Composer 安装命令:

composer require tecsiaron/ublrenderer

包简介

UBL 2 HTML renderer (PHP)

README 文档

README

STILL IN TESTING PHASE
Should not be used in production
PHP Library to convert RO eFactura UBL/ZIP files to HTML/PDF*
Check Sample PDF and Sample HTML
Uses Twig for templating and supports user defined templates.
Requirements:

  • php 8.2 or newer
  • ext-xmlreader
  • ext-bcmath
  • ext-zip
  • ext-libxml

Instalation:

composer require tecsiaron/ublrenderer

Usage in shell:

php vendor/bin/ubl2html.php <input.xml or input.zip> <output.html>

Simple usage in php (with XML file):

$content=file_get_contents("path_to.xml");
$renderer = new UBLRenderer($content);
$renderer->WriteFile();

Simple usage with ANAF ZIP

$content=UBLRenderer::LoadUBLFromZip("test.zip")->ubl;
$renderer = new UBLRenderer($content);
$renderer->WriteFile();

In both of the above cases the file will be written to vendor/tecsiaron/ublrenderer/output
To specify where files are written call WriteFile (or WriteFiles) like this:

$renderer->WriteFiles(new HTMLFileWriter("path_to_output.html"));

Advanced usage:

// get the contents of the XML
$renderer = new UBLRenderer($content);
$invoice=$renderer->ParseUBL();
$validation=$invoice->CanRender();
$validationFailReason="Validation failed:\n";
if(is_array($validation))
{
	echo "Failed to render invoice: ". implode("\n", $validation)
}
else
{
	$html=$renderer->CreateHTML(invoice);
}

*For PDF support install ublrenderer-pdf and use PDFWriter

composer require tecsiaron/ublrenderer-pdf

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2024-07-18