A PHP package for implementing web services required by the Italian Exchange System (aka “SdI”).
(Pacchetto PHP per l’implementazione dei webservices TrasmissioneFatture e RicezioneFatture richiesti dal SdI).
Please refer to
- PHP SdICoop - Client to connect to SdI web services
- PHP E-invoice It for managing italian e-invoice and notice XML formats
See Forum Italia - Fatturazione Elettronica for server configuration, interoperability tests, etc. In particular:
- Apache configuration
- Accreditamento SDICoop: configurazione SSL su Apache - Fatturazione Elettroni…
- Interoperability tests
- Test Interoperabilità Soluzioni - Fatturazione Elettronica - Forum Italia
Just include examples/tramissione-fatture.php in your endpoint. For example, if your test endpoint is
https://test.example.com/trasmissione/index.php
put the following code in your index.php:
<?php
require_once('/path/to/php-sdicoop-server/examples/trasmissione-fatture.php');
Just include examples/ricezione-fatture.php in your endpoint. For example, if your test endpoint is
https://test.example.com/ricezione/index.php
put the following code in your index.php:
<?php
require_once('/path/to/php-sdicoop-server/examples/ricezione-fatture.php');
- PHP 5.5+
php-soap
composer require taocomp/php-sdicoop-server
- Clone/download the repository
require_once('/path/to/php-sdicoop-server/vendor/autoload.php');
Please note namespace is changed (v0.1.1), it is now Taocomp\Einvoicing\SdicoopServer.
So to use e.g. WebService class:
use \Taocomp\Einvoicing\SdicoopServer\WebService;
- Copy
examples/TrasmissioneFattureHandler.phpsomewhere in your project and add logic for saving invoices and notices on filesystem and/or database - Copy then content of
examples/trasmissione-fatture.phpin your endpoint file - Modify paths accordingly
For example, if your handler class is:
class MyTrasmissioneFattureHandler
{
//...
}
saved in /path/to/MyTrasmissioneFattureHandler.php, then the code in your endpoint will be:
ini_set("soap.wsdl_cache_enabled", 0);
ini_set('soap.wsdl_cache_ttl', 0);
use \Taocomp\Einvoicing\SdicoopServer\WebService;
try
{
require_once('/path/to/php-sdicoop-server/vendor/autoload.php');
require_once('/path/to/MyTrasmissioneFattureHandler.php');
$wsdl = '/path/to/php-sdicoop-server/assets/wsdl/TrasmissioneFatture_v1.1.wsdl';
$ws = new WebService($wsdl);
$ws->setClass('\MyTrasmissioneFattureHandler');
$ws->handle();
}
catch (\Exception $e)
{
WebService::log($e->getMessage(), LOG_ERR);
}
Follow the same instructions as in “TrasmissioneFatture”.
Both web services write on system log.
For example, when you receive a notice “RicevutaConsegna”:
Dec 14 23:52:32 web Taocomp\Einvoicing\SdicoopServer\WebService: RicevutaConsegna IdentificativoSdI:7045996 NomeFile:ITXXXXXXXXXXX_00001_RC_002.xml
We want to thank all contributors of Forum Italia - Fatturazione Elettronica who have shared their snippets and any available info.
GPLv3.