uctoplus/ubl-wrapper
最新稳定版本:v1.3.1
Composer 安装命令:
composer require uctoplus/ubl-wrapper
包简介
A PHP wrapper for UBL documents
关键字:
README 文档
README
About The Project
You can install new
$ composer require uctoplus/ubl-wrapper
Supported UBL versions
UBL 2.1
http://docs.oasis-open.org/ubl/os-UBL-2.1/UBL-2.1.html
[comming soon] UBL 2.3
http://docs.oasis-open.org/ubl/os-UBL-2.3/UBL-2.3.html
Getting Started
To get a local copy up and running follow these simple steps.
Generate UBL Documents
$generator = new Generator(); $invoice = new Invoice(); $invoice->setID(1); $invoice->setIssueDate(Carbon::now()); $invoice->addNote("Note No. 1!!!"); $invoice->addNote(new NoteType("Note No. 2!!!", ["languageID" => "en"])); // Create AccountingSupplierParty $accountingSupplierParty = new SupplierPartyType(); $invoice->setAccountingSupplierParty($accountingSupplierParty); // Create AccountingCustomerParty $accountingCustomerParty = new CustomerPartyType(); $invoice->setAccountingCustomerParty($accountingCustomerParty); // Create LegalMonetaryTotal $legalMonetaryTotal = new MonetaryTotalType(); $payableAmount = new PayableAmountType(); $payableAmount->setCurrencyIDAttribute("EUR"); $payableAmount->setValue(15.35); $legalMonetaryTotal->setPayableAmount($payableAmount); $invoice->setLegalMonetaryTotal($legalMonetaryTotal); // Create InvoiceLine $invoiceLine = new InvoiceLineType(); $invoiceLine->setID("1"); $invoiceLine->setLineExtensionAmount(new LineExtensionAmountType("555", ["currencyID" => "EUR"])); $item = new ItemType(); $item->setName("Item"); $invoiceLine->setItem($item); $invoice->addInvoiceLine($invoiceLine); $generator->addDocument($invoice); $generator->save( 'path/to/file.xml' );
When multiple documents are provided to generator zip file will be generated as default. When flag $aggregated=true is
provided to $generator->save( $file_path, $aggregated = false);, aggregated XML will be generated using UCT xsd
scheme. This is useful for Import/Export in large amount of documents.
Parse UBL Documents
$parser = new Parser(); $parser->fromFile('tests/resources/UBL-Invoice-2.1-Example.xml'); $parser->getDocuments();
About The Author
This package was created by Účto+ / doq.to to provide support for UBL standard.
统计信息
- 总下载量: 4.3k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2022-02-10