PHP code example of filippo-toso / p7m-extractor

1. Go to this page and download the library: Download filippo-toso/p7m-extractor 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/ */

    

filippo-toso / p7m-extractor example snippets


use FilippoToso\P7MExtractor\P7M;

$success = (new P7M())
    ->setSource('source.pdf.p7m')
    ->setDestination('destination.pdf')
    ->save();

use FilippoToso\P7MExtractor\P7M;

$success = P7M::convert('source.pdf.p7m', 'destination.pdf');

use FilippoToso\P7MExtractor\P7M;

$success = (new P7M('/custom/path/to/openssl'))
    ->setSource('source.pdf.p7m')
    ->setDestination('destination.pdf')
    ->save();

$success = P7M::convert('source.pdf.p7m', 'destination.pdf', '/custom/path/to/openssl');

use FilippoToso\P7MExtractor\P7M;

$success = (new P7M('/custom/path/to/openssl'))
    ->setParams(['{$openssl}', 'cms', '-verify', '-noverify', '-no_attr_verify', '-binary', '-in', '{$source}', '-inform', 'DER', '-out', '{$destination}'])
    ->setSource('source.pdf.p7m')
    ->setDestination('destination.pdf')
    ->save();
bash
which openssl