PHP code example of cloud-dfe / sdk-php
1. Go to this page and download the library: Download cloud-dfe/sdk-php 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/ */
cloud-dfe / sdk-php example snippets
use CloudDfe\SdkPHP\Nfe;
try {
// DEFINIÇÕES DOS PARAMETROS BASICOS
$params = [
"token" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbXAiOiJ0b2tlbl9leGVtcGxvIiwidXNyIjoidGsiLCJ0cCI6InRrIn0.Tva_viCMCeG3nkRYmi_RcJ6BtSzui60kdzIsuq5X-sQ",
"ambiente" => Nfe::AMBIENTE_HOMOLOGACAO,
"options" => [
"debug" => false,
"timeout" => 60,
"port" => 443,
"http_version" => CURL_HTTP_VERSION_NONE
]
];
// INSTANCIE A CLASSE PARA A OPERAÇÃO DESEJADA
$nfe = new Nfe($params);
$resp = $nfe->status();
// resp RETORNA O OBJETO DE RETORNO DA API
echo "<pre>";
print_r($resp);
echo "</pre>";
} catch (\Exception $e) {
echo $e->getMessage();
}
composer