PHP code example of notafacil-io / php-common-notafacil

1. Go to this page and download the library: Download notafacil-io/php-common-notafacil 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/ */

    

notafacil-io / php-common-notafacil example snippets




NotaFacil\Common\Services\AuthNotaFacil;
use NotaFacil\Common\Exceptions\NotaFacilException;

try {
    
    $credentials = [
        "login" => "LOGIN_SOFTHOUSE",
        "password" => "SENHA_SOFTHOUSE",
        "secret_key" => "SECRET_KEY_SOFTHOUSE"
    ];

    $clientNotaFacil =(new AuthNotaFacil())->attempt($credentials)
                       // ->getResponse();
                       ->getDataAuth();

    dump($clientNotaFacil);

} catch (NotaFacilException $th) {
    dump($th->getMessage(), $th->getCode());
}