PHP code example of kryptonpay / nfse-bh-sdk-new

1. Go to this page and download the library: Download kryptonpay/nfse-bh-sdk-new 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/ */

    

kryptonpay / nfse-bh-sdk-new example snippets

 7.2

    use Exception;
    use NFse\Config\Boot;
    use NFse\Helpers\Utils;
    use NFse\Models\Settings;

    try {
        //ambiente
        $settings = new Settings();
        $settings->environment = 'homologacao';

        //Emitente
        $settings->issuer->name = 'LINK SERVICOS DE CERTIFICACAO DIGITAL LTDA';
        $settings->issuer->cnpj = 11508222000136;
        $settings->issuer->imun = 2530360019;
        $settings->issuer->codMun = 3106200;

        //certificado digital
        $settings->certificate->folder = __DIR__ . '/../storage/certificates/' . $settings->issuer->cnpj . '/';
        $settings->certificate->certFile = 'certificate.pfx';
        $settings->certificate->mixedKey = 'mixedKey.pem';
        $settings->certificate->privateKey = 'privateKey.pem';
        $settings->certificate->publicKey = 'publicKey.pem';
        $settings->certificate->password = '215424958751';
        $settings->certificate->noValidate = true;

        //dev
        if ($settings->environment == 'homologacao') {
            Utils::xdebugMode();
        }

        //efetua o boot no lib
        $system = new Boot($settings);
        $system->init();

    } catch (Exception $e) {
        throw $e;
    }