PHP code example of controlaltjeff / p7m-fattura-decoder
1. Go to this page and download the library: Download controlaltjeff/p7m-fattura-decoder library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
controlaltjeff / p7m-fattura-decoder example snippets
use Controlaltjeff\P7MDecoder\P7MDecoder;
// Decodifica da file
$xml = P7MDecoder::decodeFile('fattura.xml.p7m');
// Decodifica da stringa
$xml = P7MDecoder::decodeString($p7mContent);
if ($xml === null) {
throw new \RuntimeException('Impossibile decodificare il file P7M');
}
// Correzioni automatiche applicate durante la decodifica
$corrections = P7MDecoder::getLastCorrections();
foreach ($corrections as $fix) {
echo "Tag corretto: {$fix['from']} → {$fix['to']}\n";
}