PHP code example of feimx / csd-converter

1. Go to this page and download the library: Download feimx/csd-converter 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/ */

    

feimx / csd-converter example snippets

 php
$converter = new FeiMx\Csd\CsdConverter();
echo $converter->serial_number();
 php
echo $converter->serial_number;
echo $converter->tax_id;
echo $converter->valid_from; // instance of Carbon
echo $converter->valid_to; // instance of Carbon
echo $converter->getStatus();
 php
if($converter->getStatus() === CsdConverter::VALID){}
if($converter->getStatus() === CsdConverter::INVALID){}
if($converter->getStatus() === CsdConverter::EXPIRED){}

 php
var_dump($converter->isValidCsd()); // true or false
 php
$path = __DIR__.'/temp/';
$filename = 'VALIDCSD';
$converter->save($path, $filename);
//this create 4 files:
//__DIR__.'/temp/VALIDCSD.cer'
//__DIR__.'/temp/VALIDCSD.cer.pem'
//__DIR__.'/temp/VALIDCSD.key'
//__DIR__.'/temp/VALIDCSD.key.pem'
 php
$file = __DIR__.'/temp/VALIDCSD.key.pem';
$password = 'secret';
$converter->encryptKey($file, $password);
//__DIR__.'/temp/VALIDCSD.enc.key'