robertogallea/php-fatturapa 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

robertogallea/php-fatturapa

最新稳定版本:0.2.7

Composer 安装命令:

composer require robertogallea/php-fatturapa

包简介

Php package for Fattura Elettronica PA

README 文档

README

php-fatturapa is a php implementation for FatturaPA XML specification. It allows reading from and writing to files formatted as described in the current specifications

1. Installation

To install php-fatturapa, require it using composer:

composer require robertogallea/php-fatturapa 

2. Usage

php-fatturapa currently supports only the Fattura Ordinaria model (not Fattura Semplificata)

The whole DOM of the XML document is wrapped by the class FatturaOrdinaria, which could be used directly or build using FatturaPA class.

Follow some basic usage exmaples:

2.1 Read From XML document file

/*   
 * Read from XML
 */
 $filename = 'IT01234567890_FPA01.xml';
 $fattura = FatturaPA::readFromXML($filename); 

2.2 Read From signed XML file

/*   
 * Read from XML signed document
 */
 $filename = 'IT01879020517_e4duu.xml.p7m';
 $fattura = FatturaPA::readFromSignedXML($filename); 

2.3 Read From XML string

/*   
 * Read from XML string
 */
 $xml = '<your-xml-string>';
 $fattura = FatturaPA::readFromXMLString($xml); 

2.4 Write to XML file

/*   
 * Read from XML
 */
 $filename = 'IT01234567890_FPA01.xml';
 FatturaPA::writeToXML($fattura, $filename); 

2.5 Write to XML string

/*   
 * Write to XML string
 */
 $xml = FatturaPA::writeToXMLString($fattura); 

3. Attachment handling

php-fatturapa provides methods for easily add and extract attachments to and from the XML document.
By specifications they are stored inside the FatturaElettronicaBody element, so theFatturaElettronicaBody class provides convenient methods for storing attachments performing the required compresson and base64 encoding:

/*   
 * Export attachments to folder
 */
 $filename = 'IT01234567890_FPA01.xml';
 $fattura = FatturaPA::readFromXML($filename);
 $folder = '/your/path';  
 
 foreach ($fattura->getFatturaElettronicaBody() as $body);
   $body->esportaAllegati($folder);
 }
/*   
 * Add attachment
 */
 $filename = 'IT01234567890_FPA01.xml';
 $fattura = FatturaPA::readFromXML($filename);
 $attachment_filename = /path/to.pdf;
 $attachment = Allegati::createFromFile($attachment_filename,'Name','Description');
 $fattura->getFatturaElettronicaBody()[0]->addAttachment($attachment);
 

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2019-03-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固