├── VERSION.txt ├── bootstrap.php ├── src ├── Certificado.php ├── Gnre.php ├── Util.php ├── Emitente.php ├── Base.php ├── Sintegra.php ├── Averbacao.php ├── Webhook.php ├── Softhouse.php ├── Dfe.php ├── Nfcom.php ├── Services.php ├── Client.php ├── Nfce.php ├── Cte.php ├── CteOS.php ├── Nfse.php ├── Mdfe.php └── Nfe.php ├── sdk-nativo ├── IClass.php └── Services.php ├── pjpunit.xml.disp ├── composer.json ├── README.md └── .sensiolabs.yml /VERSION.txt: -------------------------------------------------------------------------------- 1 | 1.0.x-dev 2 | -------------------------------------------------------------------------------- /bootstrap.php: -------------------------------------------------------------------------------- 1 | client->send("POST", "/certificado", $payload); 15 | } 16 | 17 | /** 18 | * @return \stdClass 19 | * @throws \Exception 20 | */ 21 | public function mostra() 22 | { 23 | return $this->client->send("GET", "/certificado", []); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Gnre.php: -------------------------------------------------------------------------------- 1 | client->send("GET", "/gnre/{$key}", []); 16 | } 17 | 18 | /** 19 | * @param array $payload 20 | * @return \stdClass 21 | * @throws \Exception 22 | */ 23 | public function cria($payload) 24 | { 25 | return $this->client->send("POST", "/gnre", $payload); 26 | } 27 | 28 | /** 29 | * @param array $payload 30 | * @return \stdClass 31 | * @throws \Exception 32 | */ 33 | public function configUf($payload) 34 | { 35 | return $this->client->send("POST", "/gnre/configuf", $payload); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Util.php: -------------------------------------------------------------------------------- 1 | client->send("GET", "/emitente/token", []); 14 | } 15 | 16 | /** 17 | * @param array $payload 18 | * @return \stdClass 19 | * @throws \Exception 20 | */ 21 | public function atualiza($payload) 22 | { 23 | return $this->client->send("PUT", "/emitente", $payload); 24 | } 25 | 26 | /** 27 | * @return \stdClass 28 | * @throws \Exception 29 | */ 30 | public function mostra() 31 | { 32 | return $this->client->send("GET", "/emitente", []); 33 | } 34 | 35 | /** 36 | * @param array $payload 37 | * @return \stdClass 38 | * @throws \Exception 39 | */ 40 | public function webhook($payload) 41 | { 42 | return $this->client->send("POST", "/webhook", $payload); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /sdk-nativo/IClass.php: -------------------------------------------------------------------------------- 1 | services = new IServicesNFe($ambiente, $token); 9 | } 10 | 11 | public static function checkKey($payload) 12 | { 13 | if (!isset($payload["chave"])) { 14 | throw new \Exception("A chave não foi informada."); 15 | } 16 | 17 | $key = preg_replace("/[^0-9]/", "", $payload["chave"]); 18 | 19 | if (empty($key) || strlen($key) != 44) { 20 | throw new \Exception("A chave deve ter 44 dígitos numéricos."); 21 | } 22 | 23 | return $key; 24 | } 25 | 26 | public function exemplo_post($payload) 27 | { 28 | return $this->services->request("POST", "/rota", $payload); 29 | } 30 | 31 | public function exemple_consulta($payload) 32 | { 33 | $key = self::checkKey($payload); 34 | return $this->services->request("GET", "/rota/{$key}", []); 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /src/Base.php: -------------------------------------------------------------------------------- 1 | $params["token"] ?? null, 17 | "ambiente" => $params["ambiente"] ?? null, 18 | "timeout" => $params["timeout"] ?? null, 19 | "port" => $params["port"] ?? null, 20 | "http_version" => $params["http_version"] ?? null, 21 | "debug" => $params["debug"] ?? null, 22 | "options" => $params["options"] ?? null 23 | ]; 24 | 25 | $this->client = new Client($config); 26 | } 27 | 28 | // @param array $payload 29 | // @return \stdClass 30 | protected static function checkKey($payload) 31 | { 32 | $key = preg_replace("/[^0-9]/", "", $payload["chave"]); 33 | if (empty($key) || strlen($key) != 44) { 34 | throw new \Exception("A chave deve ter 44 digitos numericos"); 35 | } 36 | return $key; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Sintegra.php: -------------------------------------------------------------------------------- 1 | client = new Client($params, "sintegra"); 19 | } 20 | 21 | /** 22 | * Send post request to uploads 23 | * @param array $payload 24 | * @return \stdClass 25 | */ 26 | public function upload($payload) 27 | { 28 | return $this->client->sendMultipart("/upload", $payload); 29 | } 30 | 31 | /** 32 | * Send json port request to gerar 33 | * @param array $payload 34 | * @return \stdClass 35 | */ 36 | public function gerar($payload) 37 | { 38 | return $this->client->send("POST", "/gerar", $payload); 39 | } 40 | 41 | /** 42 | * Send json port request to consular 43 | * @param array $payload 44 | * @return \stdClass 45 | */ 46 | public function consultar($payload) 47 | { 48 | return $this->client->send("POST", "/consulta", $payload); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /pjpunit.xml.disp: -------------------------------------------------------------------------------- 1 | 2 | 15 | 16 | 17 | tests 18 | 19 | 20 | 21 | 22 | src/ 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/Averbacao.php: -------------------------------------------------------------------------------- 1 | client->send("POST", "/averbacao/atm", $payload); 16 | } 17 | 18 | /** 19 | * @param array $payload 20 | * @return \stdClass 21 | * @throws \Exception 22 | */ 23 | public function atmCancela($payload) 24 | { 25 | return $this->client->send("POST", "/averbacao/atm/cancela", $payload); 26 | } 27 | 28 | /** 29 | * @param array $payload 30 | * @return \stdClass 31 | * @throws \Exception 32 | */ 33 | public function elt($payload) 34 | { 35 | return $this->client->send("POST", "/averbacao/elt", $payload); 36 | } 37 | 38 | /** 39 | * @param array $payload 40 | * @return \stdClass 41 | * @throws \Exception 42 | */ 43 | public function portoSeguro($payload) 44 | { 45 | return $this->client->send("POST", "/averbacao/portoseguro", $payload); 46 | } 47 | 48 | /** 49 | * @param array $payload 50 | * @return \stdClass 51 | * @throws \Exception 52 | */ 53 | public function portoSeguroCancela($payload) 54 | { 55 | return $this->client->send("POST", "/averbacao/portoseguro/cancela", $payload); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/Webhook.php: -------------------------------------------------------------------------------- 1 | signature)) { 22 | throw new \Exception("Payload incorreto não contêm a assinatura."); 23 | } 24 | if (empty($token)) { 25 | throw new \Exception("Token vazio."); 26 | } 27 | $c = base64_decode($std->signature); 28 | $ivlen = openssl_cipher_iv_length($cipher); 29 | $iv = substr($c, 0, $ivlen); 30 | $hmac = substr($c, $ivlen, $sha2len = 32); 31 | $ciphertext_raw = substr($c, $ivlen + $sha2len); 32 | $original_time = (float) openssl_decrypt($ciphertext_raw, $cipher, "{$token}", OPENSSL_RAW_DATA, $iv); 33 | $calcmac = hash_hmac("sha256", $ciphertext_raw, "{$token}", true); 34 | if (hash_equals($hmac, $calcmac)) { 35 | $dif = (time() - $original_time); //diferença em segundos 36 | if ($dif < 300) { 37 | return true; 38 | } 39 | throw new \Exception("Assinatura Expirou !!"); 40 | } 41 | throw new \Exception("Token ou assinatura incorreta."); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cloud-dfe/sdk-php", 3 | "type": "library", 4 | "description": "SDK para comunicação com a API CloudDFe.", 5 | "keywords": ["CloudDFe", "nfe","nfce","sped"], 6 | "homepage": "https://github.com/cloud-dfe/sdk-php", 7 | "license": ["LGPL-3.0-or-later", "GPL-3.0-or-later", "MIT"], 8 | "authors": [ 9 | { 10 | "name": "Roberto L. Machado", 11 | "email": "linux.rlm@gmail.com.br", 12 | "homepage": "http://www.cloud-dfe.com.br", 13 | "role": "Developer" 14 | }, { 15 | "name": "Cleiton Perin", 16 | "email": "cperin20@gmail.com.br", 17 | "homepage": "http://www.cloud-dfe.com.br", 18 | "role": "Developer" 19 | } 20 | ], 21 | "require": { 22 | "php" : ">= 5.6", 23 | "ext-curl": "*", 24 | "ext-dom": "*", 25 | "ext-json": "*", 26 | "ext-simplexml": "*", 27 | "ext-libxml": "*", 28 | "ext-openssl": "*", 29 | "ext-zlib": "*" 30 | }, 31 | "require-dev": { 32 | "squizlabs/php_codesniffer": "^3.4", 33 | "phpunit/phpunit": "^7.5", 34 | "scrutinizer/ocular": "^1.3", 35 | "sebastian/phpcpd": "^4.1", 36 | "phpstan/phpstan": "^0.9.2" 37 | }, 38 | "autoload": { 39 | "psr-4": { 40 | "CloudDfe\\SdkPHP\\": "src/" 41 | } 42 | }, 43 | "autoload-dev": { 44 | "psr-4": { 45 | "CloudDfe\\SdkPHP\\Tests\\": "tests/" 46 | } 47 | }, 48 | "scripts": { 49 | "test": "vendor/bin/phpunit -c phpunit.xml.dist", 50 | "phpcbf": "vendor/bin/phpcbf --standard=psr2 src", 51 | "phpcs": "vendor/bin/phpcs --standard=psr2 src", 52 | "phpstan": "vendor/bin/phpstan analyse src/ --level 1" 53 | }, 54 | "extra": { 55 | "branch-alias": { 56 | "v0.2": "v0.2-dev" 57 | } 58 | }, 59 | "minimum-stability": "stable" 60 | } 61 | -------------------------------------------------------------------------------- /src/Softhouse.php: -------------------------------------------------------------------------------- 1 | client->send("POST", "/soft/emitente", $payload); 15 | } 16 | 17 | /** 18 | * @param array $payload 19 | * @return \stdClass 20 | * @throws \Exception 21 | */ 22 | public function atualizaEmitente($payload) 23 | { 24 | return $this->client->send("PUT", "/soft/emitente", $payload); 25 | } 26 | 27 | /** 28 | * @param array $payload 29 | * @return \stdClass 30 | * @throws \Exception 31 | */ 32 | public function mostraEmitente($payload) 33 | { 34 | if (empty($payload) || empty($payload["doc"])) { 35 | throw new \Exception("Deve ser passado um CNPJ ou um CPF para efetuar a deleçao do emitente."); 36 | } 37 | $doc = $payload["doc"]; 38 | return $this->client->send("GET", "/soft/emitente/$doc"); 39 | } 40 | 41 | /** 42 | * @param array $payload 43 | * @return \stdClass 44 | * @throws \Exception 45 | */ 46 | public function listaEmitentes($payload) 47 | { 48 | $status = !empty($payload["status"]) ? $payload["status"] : ""; 49 | $rota = "/soft/emitente"; 50 | if ($status == "deletados" || $status == "inativos") { 51 | $rota = "/soft/emitente/deletados"; 52 | } 53 | return $this->client->send("GET", $rota, []); 54 | } 55 | 56 | /** 57 | * @param array $payload 58 | * @return \stdClass 59 | * @throws \Exception 60 | */ 61 | public function deletaEmitente($payload) 62 | { 63 | if (empty($payload) || empty($payload["doc"])) { 64 | throw new \Exception("Deve ser passado um CNPJ ou um CPF para efetuar a deleçao do emitente."); 65 | } 66 | $doc = $payload["doc"]; 67 | return $this->client->send("DELETE", "/soft/emitente/$doc", []); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/Dfe.php: -------------------------------------------------------------------------------- 1 | client->send("POST", "/dfe/cte", $payload); 15 | } 16 | 17 | /** 18 | * @param array $payload 19 | * @return \stdClass 20 | * @throws \Exception 21 | */ 22 | public function buscaNfe($payload) 23 | { 24 | return $this->client->send("POST", "/dfe/nfe", $payload); 25 | } 26 | 27 | /** 28 | * @param array $payload 29 | * @return \stdClass 30 | * @throws \Exception 31 | */ 32 | public function downloadNfe($payload) 33 | { 34 | $key = self::checkKey($payload); 35 | return $this->client->send("GET", "/dfe/nfe/{$key}", []); 36 | } 37 | 38 | /** 39 | * @param array $payload 40 | * @return \stdClass 41 | * @throws \Exception 42 | */ 43 | public function buscaNfse($payload) 44 | { 45 | return $this->client->send("POST", "/dfe/nfse", $payload); 46 | } 47 | 48 | /** 49 | * @param array $payload 50 | * @return \stdClass 51 | * @throws \Exception 52 | */ 53 | public function downloadNfse($payload) 54 | { 55 | $key = self::checkKey($payload); 56 | return $this->client->send("GET", "/dfe/nfse/{$key}", []); 57 | } 58 | 59 | /** 60 | * @param array $payload 61 | * @return \stdClass 62 | * @throws \Exception 63 | */ 64 | public function downloadCte($payload) 65 | { 66 | $key = self::checkKey($payload); 67 | return $this->client->send("GET", "/dfe/cte/{$key}", []); 68 | } 69 | 70 | /** 71 | * @param array $payload 72 | * @return \stdClass 73 | * @throws \Exception 74 | */ 75 | public function eventos($payload) 76 | { 77 | $key = self::checkKey($payload); 78 | return $this->client->send("GET", "/dfe/eventos/{$key}", []); 79 | } 80 | 81 | /** 82 | * @param array $payload 83 | * @return \stdClass 84 | * @throws \Exception 85 | */ 86 | public function backup($payload) 87 | { 88 | return $this->client->send("POST", "/dfe/backup", $payload); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /src/Nfcom.php: -------------------------------------------------------------------------------- 1 | client->send("GET", "/nfcom/status", []); 14 | } 15 | 16 | /** 17 | * @param array $payload 18 | * @return \stdClass 19 | * @throws \Exception 20 | */ 21 | public function cria($payload) 22 | { 23 | return $this->client->send("POST", "/nfcom", $payload); 24 | } 25 | 26 | /** 27 | * @param array $payload 28 | * @return \stdClass 29 | * @throws \Exception 30 | */ 31 | public function consulta($payload) 32 | { 33 | $key = self::checkKey($payload); 34 | return $this->client->send("GET", "/nfcom/{$key}", $payload); 35 | } 36 | 37 | /** 38 | * @param array $payload 39 | * @return \stdClass 40 | * @throws \Exception 41 | */ 42 | public function cancela($payload) 43 | { 44 | return $this->client->send("POST", "/nfcom/cancela", $payload); 45 | } 46 | 47 | /** 48 | * @param array $payload 49 | * @return \stdClass 50 | * @throws \Exception 51 | */ 52 | public function busca($payload) 53 | { 54 | return $this->client->send("POST", "/nfcom/busca", $payload); 55 | } 56 | 57 | /** 58 | * @param array $payload 59 | * @return \stdClass 60 | * @throws \Exception 61 | */ 62 | public function pdf($payload) 63 | { 64 | $key = self::checkKey($payload); 65 | return $this->client->send("GET", "/nfcom/pdf/{$key}", []); 66 | } 67 | 68 | /** 69 | * @param array $payload 70 | * @return \stdClass 71 | * @throws \Exception 72 | */ 73 | public function preview($payload) 74 | { 75 | return $this->client->send("POST", "/nfcom/preview", $payload); 76 | } 77 | 78 | /** 79 | * @param array $payload 80 | * @return \stdClass 81 | * @throws \Exception 82 | */ 83 | public function backup($payload) 84 | { 85 | return $this->client->send("POST", "/nfcom/backup", $payload); 86 | } 87 | 88 | /** 89 | * @param array $payload 90 | * @return \stdClass 91 | * @throws \Exception 92 | */ 93 | public function importa($payload) 94 | { 95 | return $this->client->send("POST", "/nfcom/importa", $payload); 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /src/Services.php: -------------------------------------------------------------------------------- 1 | null, "message" => null]; 24 | 25 | public function __construct($config) 26 | { 27 | $this->base_uri = $config["base_uri"]; 28 | 29 | $this->timeout = $config["timeout"] ?? $this->timeout; 30 | $this->port = $config["port"] ?? $this->port; 31 | $this->http_version = $config["http_version"] ?? $this->http_version; 32 | 33 | $this->debug = $config["debug"] ?? $this->debug; 34 | } 35 | 36 | // @param string $method 37 | // @param string $route 38 | // @param array $payload 39 | // @param array $headers 40 | // @return string 41 | // @throws \Exception 42 | public function request($method, $route, $payload = [], $headers = []) 43 | { 44 | $data = json_encode($payload); 45 | 46 | $oCurl = curl_init(); 47 | curl_setopt_array($oCurl, [ 48 | CURLOPT_URL => "{$this->base_uri}{$route}", 49 | CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4, 50 | CURLOPT_RETURNTRANSFER => true, 51 | CURLOPT_ENCODING => "", 52 | CURLOPT_MAXREDIRS => 10, 53 | CURLOPT_HEADER => false, 54 | CURLOPT_CONNECTTIMEOUT => $this->timeout, 55 | CURLOPT_TIMEOUT => $this->timeout, 56 | CURLOPT_FOLLOWLOCATION => true, 57 | CURLOPT_POSTREDIR => CURL_REDIR_POST_ALL, 58 | CURLOPT_SSL_VERIFYHOST => 0, 59 | CURLOPT_SSL_VERIFYPEER => 0, 60 | CURLOPT_HTTP_VERSION => $this->http_version, 61 | CURLOPT_CUSTOMREQUEST => $method, 62 | CURLOPT_POSTFIELDS => $data, 63 | CURLOPT_HTTPHEADER => $headers 64 | ]); 65 | 66 | $response = curl_exec($oCurl); 67 | 68 | $this->error["message"] = curl_error($oCurl); 69 | $this->error["code"] = curl_errno($oCurl); 70 | 71 | curl_close($oCurl); 72 | 73 | if (!empty($this->error["message"])) { 74 | throw new \Exception("Falha de comunicação! [{$this->error["code"]}] {$this->error["message"]}", 500); 75 | } 76 | return json_decode($response); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /sdk-nativo/Services.php: -------------------------------------------------------------------------------- 1 | [ 13 | '1' => 'https://api.integranotas.com.br/v1', 14 | '2' => 'https://hom-api.integranotas.com.br/v1' 15 | ] 16 | ]; 17 | 18 | const AMBIENTE_PRODUCAO = 1; 19 | const AMBIENTE_HOMOLOGACAO = 2; 20 | 21 | public function __construct($ambiente, $token) 22 | { 23 | if (!in_array($ambiente, [1, 2, self::AMBIENTE_PRODUCAO, self::AMBIENTE_HOMOLOGACAO])) { 24 | throw new \Exception("O ambiente deve ser 1-produção ou 2-homologação."); 25 | } 26 | 27 | if (!isset($token) || empty($token)) { 28 | throw new \Exception("O token de emitente é obrigatório."); 29 | } 30 | 31 | $this->base_uri = self::URLS["api"][$ambiente]; 32 | $this->token = $token; 33 | } 34 | 35 | public function request($method, $route, $payload = []) 36 | { 37 | $headers = [ 38 | "Authorization: {$this->token}", 39 | "Content-Type: application/json", 40 | "Accept: application/json" 41 | ]; 42 | 43 | $data = json_encode($payload); 44 | 45 | $oCurl = curl_init(); 46 | curl_setopt_array($oCurl, [ 47 | CURLOPT_URL => "{$this->base_uri}{$route}", 48 | CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4, 49 | CURLOPT_RETURNTRANSFER => true, 50 | CURLOPT_ENCODING => "", 51 | CURLOPT_MAXREDIRS => 10, 52 | CURLOPT_HEADER => false, 53 | CURLOPT_CONNECTTIMEOUT => $this->timeout, 54 | CURLOPT_TIMEOUT => $this->timeout, 55 | CURLOPT_FOLLOWLOCATION => true, 56 | CURLOPT_POSTREDIR => CURL_REDIR_POST_ALL, // VERIFICAR 57 | CURLOPT_SSL_VERIFYHOST => 0, 58 | CURLOPT_SSL_VERIFYPEER => 0, 59 | CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_NONE, 60 | CURLOPT_CUSTOMREQUEST => $method, 61 | CURLOPT_POSTFIELDS => $data, 62 | CURLOPT_HTTPHEADER => $headers 63 | ]); 64 | 65 | $response = curl_exec($oCurl); 66 | 67 | $error["message"] = curl_error($oCurl); 68 | $error["code"] = curl_errno($oCurl); 69 | 70 | curl_close($oCurl); 71 | 72 | if (!empty($error["message"])) { 73 | throw new \Exception("Erro ao realizar a requisição: {$error["message"]}"); 74 | } 75 | 76 | return $response; 77 | } 78 | 79 | } -------------------------------------------------------------------------------- /src/Client.php: -------------------------------------------------------------------------------- 1 | [ 9 | '1' => 'https://api.integranotas.com.br/v1', 10 | '2' => 'https://hom-api.integranotas.com.br/v1' 11 | ] 12 | ]; 13 | 14 | // Variaveis de ambiente 15 | const AMBIENTE_PRODUCAO = 1; 16 | const AMBIENTE_HOMOLOGACAO = 2; 17 | 18 | // @var int 19 | protected $ambiente; 20 | // @var string 21 | protected $token; 22 | 23 | // @var int 24 | protected $timeout; 25 | // @var int 26 | protected $port; 27 | // @var int 28 | protected $http_version; 29 | 30 | // @var bool 31 | protected $debug; 32 | 33 | // @var Service 34 | protected $services; 35 | 36 | public function __construct($params = []) 37 | { 38 | if (empty($params)) { 39 | throw new \Exception("Devem ser passados os parametros básicos."); 40 | } 41 | if (!in_array($params["ambiente"], [1, 2, self::AMBIENTE_PRODUCAO, self::AMBIENTE_HOMOLOGACAO])) { 42 | throw new \Exception("O ambiente deve ser 1-produção ou 2-homologação."); 43 | } 44 | if (empty($params["token"])) { 45 | throw new \Exception("O token é obrigatorio."); 46 | } 47 | if (!empty($params["options"])) { 48 | $this->timeout = $params["options"]["timeout"] ?? $this->timeout; 49 | $this->port = $params["options"]["port"] ?? $this->port; 50 | $this->http_version = $params["options"]["http_version"] ?? $this->http_version; 51 | $this->debug = $params["options"]["debug"] ?? $this->debug; 52 | } 53 | 54 | $this->ambiente = !empty($params["ambiente"]) ? $params["ambiente"] : 2; 55 | $this->token = $params["token"] ?? $this->token; 56 | 57 | $this->timeout = $params["timeout"] ?? $this->timeout; 58 | $this->port = $params["port"] ?? $this->port; 59 | $this->http_version = $params["http_version"] ?? $this->http_version; 60 | $this->debug = $params["debug"] ?? $this->debug; 61 | 62 | $config = [ 63 | "base_uri" => self::URLS["api"][$this->ambiente], 64 | "timeout" => $this->timeout, 65 | "port" => $this->port, 66 | "http_version" => $this->http_version, 67 | "debug" => $this->debug 68 | ]; 69 | 70 | $this->services = new Services($config); 71 | } 72 | 73 | 74 | public function send($method, $route, $payload = []) 75 | { 76 | $headers = [ 77 | "Authorization: {$this->token}", 78 | "Content-Type: application/json", 79 | "Accept: application/json" 80 | ]; 81 | 82 | return $this->services->request($method, $route, $payload, $headers); 83 | } 84 | 85 | public function sendMultipart($route, $payload = []) 86 | { 87 | $headers = [ 88 | "Authorization: {$this->token}", 89 | "Content-Type: multipart/form-data", 90 | "Accept: application/json" 91 | ]; 92 | 93 | return $this->services->request("POST", $route, $payload, $headers); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SDK em PHP para API Integra Notas 2 | 3 | Este SDK visa simplificar a integração do seu sistema com a nossa API, oferecendo classes com funções pré-definidas para acessar as rotas da API. Isso elimina a necessidade de desenvolver uma aplicação para se comunicar diretamente com a nossa API, tornando o processo mais eficiente e direto. 4 | 5 | *NOTA: usa apenas o cURL diretamente sem usar pacotes de terceiros.* 6 | 7 | 8 | [![Latest Version on Packagist][ico-version]][link-packagist] 9 | 10 | 11 | ## Forma de instalação do SDK 12 | 13 | ``` 14 | composer require cloud-dfe/sdk-php 15 | ``` 16 | 17 | ## Forma de uso 18 | 19 | ```php 20 | 21 | use CloudDfe\SdkPHP\Nfe; 22 | 23 | try { 24 | // DEFINIÇÕES DOS PARAMETROS BASICOS 25 | $params = [ 26 | "token" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbXAiOiJ0b2tlbl9leGVtcGxvIiwidXNyIjoidGsiLCJ0cCI6InRrIn0.Tva_viCMCeG3nkRYmi_RcJ6BtSzui60kdzIsuq5X-sQ", 27 | "ambiente" => Nfe::AMBIENTE_HOMOLOGACAO, 28 | "options" => [ 29 | "debug" => false, 30 | "timeout" => 60, 31 | "port" => 443, 32 | "http_version" => CURL_HTTP_VERSION_NONE 33 | ] 34 | ]; 35 | 36 | // INSTANCIE A CLASSE PARA A OPERAÇÃO DESEJADA 37 | 38 | $nfe = new Nfe($params); 39 | 40 | $resp = $nfe->status(); 41 | 42 | // resp RETORNA O OBJETO DE RETORNO DA API 43 | 44 | echo "
";
45 |     print_r($resp);
46 |     echo "
"; 47 | 48 | } catch (\Exception $e) { 49 | echo $e->getMessage(); 50 | } 51 | 52 | ``` 53 | 54 | ### Sobre dados de envio e retornos 55 | 56 | Para saber os detalhes referente ao dados de envio e os retornos consulte nossa documentação [IntegraNotas Documentação](https://integranotas.com.br/doc). 57 | 58 | ### Veja alguns exemplos de consumi de nossa API nos link abaixo: 59 | 60 | [Pasta de Exemplos](https://github.com/cloud-dfe/sdk-php/tree/master/examples) 61 | 62 | [Utilitários](https://github.com/cloud-dfe/sdk-php/tree/master/examples/util) 63 | 64 | [Averbação](https://github.com/cloud-dfe/sdk-php/tree/master/examples/averbacao) 65 | 66 | [Certificado Digital](https://github.com/cloud-dfe/sdk-php/tree/master/examples/certificado) 67 | 68 | [CT-e](https://github.com/cloud-dfe/sdk-php/tree/master/examples/cte) 69 | 70 | [CT-e OS](https://github.com/cloud-dfe/sdk-php/tree/master/examples/cteos) 71 | 72 | [DF-e](https://github.com/cloud-dfe/sdk-php/tree/master/examples/dfe) 73 | 74 | [Emitente](https://github.com/cloud-dfe/sdk-php/tree/master/examples/emitente) 75 | 76 | [GNR-e](https://github.com/cloud-dfe/sdk-php/tree/master/examples/gnre) 77 | 78 | [MDF-e](https://github.com/cloud-dfe/sdk-php/tree/master/examples/mdfe) 79 | 80 | [NFC-e](https://github.com/cloud-dfe/sdk-php/tree/master/examples/nfce) 81 | 82 | [NFCom](https://github.com/cloud-dfe/sdk-php/tree/master/examples/nfcom) 83 | 84 | [NF-e](https://github.com/cloud-dfe/sdk-php/tree/master/examples/nfe) 85 | 86 | [NFS-e](https://github.com/cloud-dfe/sdk-php/tree/master/examples/nfse) 87 | 88 | [Softhouse](https://github.com/cloud-dfe/sdk-php/tree/master/examples/softhouse) 89 | 90 | [ico-version]: https://img.shields.io/packagist/v/cloud-dfe/sdk-php.svg?style=flat-square 91 | [link-packagist]: https://packagist.org/packages/cloud-dfe/sdk-php 92 | -------------------------------------------------------------------------------- /src/Nfce.php: -------------------------------------------------------------------------------- 1 | client->send("POST", "/nfce", $payload); 15 | } 16 | 17 | /** 18 | * @param array $payload 19 | * @return \stdClass 20 | * @throws \Exception 21 | */ 22 | public function preview($payload) 23 | { 24 | return $this->client->send("POST", "/nfce/preview", $payload); 25 | } 26 | 27 | /** 28 | * @return \stdClass 29 | * @throws \Exception 30 | */ 31 | public function status() 32 | { 33 | return $this->client->send("GET", "/nfce/status", []); 34 | } 35 | 36 | /** 37 | * @param array $payload 38 | * @return \stdClass 39 | * @throws \Exception 40 | */ 41 | public function consulta($payload) 42 | { 43 | $key = self::checkKey($payload); 44 | return $this->client->send("GET", "/nfce/{$key}", []); 45 | } 46 | 47 | /** 48 | * @param array $payload 49 | * @return \stdClass 50 | * @throws \Exception 51 | */ 52 | public function busca($payload) 53 | { 54 | return $this->client->send("POST", "/nfce/busca", $payload); 55 | } 56 | 57 | /** 58 | * @param array $payload 59 | * @return \stdClass 60 | * @throws \Exception 61 | */ 62 | public function cancela($payload) 63 | { 64 | return $this->client->send("POST", "/nfce/cancela", $payload); 65 | } 66 | 67 | /** 68 | * @return \stdClass 69 | * @throws \Exception 70 | */ 71 | public function offline() 72 | { 73 | return $this->client->send("GET", "/nfce/offline", []); 74 | } 75 | 76 | /** 77 | * @param array $payload 78 | * @return \stdClass 79 | * @throws \Exception 80 | */ 81 | public function inutiliza($payload) 82 | { 83 | return $this->client->send("POST", "/nfce/inutiliza", $payload); 84 | } 85 | 86 | /** 87 | * @param array $payload 88 | * @return \stdClass 89 | * @throws \Exception 90 | */ 91 | public function pdf($payload) 92 | { 93 | $key = self::checkKey($payload); 94 | return $this->client->send("GET", "/nfce/pdf/{$key}", []); 95 | } 96 | 97 | /** 98 | * @param array $payload 99 | * @return \stdClass 100 | * @throws \Exception 101 | */ 102 | public function substitui($payload) 103 | { 104 | return $this->client->send("POST", "/nfce/substitui", $payload); 105 | } 106 | 107 | /** 108 | * @param array $payload 109 | * @return \stdClass 110 | * @throws \Exception 111 | */ 112 | public function backup($payload) 113 | { 114 | return $this->client->send("POST", "/nfce/backup", $payload); 115 | } 116 | 117 | /** 118 | * @param array $payload 119 | * @return \stdClass 120 | * @throws \Exception 121 | */ 122 | public function importa($payload) 123 | { 124 | return $this->client->send("POST", "/nfce/importa", $payload); 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /src/Cte.php: -------------------------------------------------------------------------------- 1 | client->send("GET", "/cte/status", []); 14 | } 15 | 16 | /** 17 | * @param array $payload 18 | * @return \stdClass 19 | * @throws \Exception 20 | */ 21 | public function consulta($payload) 22 | { 23 | $key = self::checkKey($payload); 24 | return $this->client->send("GET", "/cte/{$key}", []); 25 | } 26 | 27 | /** 28 | * @param array $payload 29 | * @return \stdClass 30 | * @throws \Exception 31 | */ 32 | public function pdf($payload) 33 | { 34 | $key = self::checkKey($payload); 35 | return $this->client->send("GET", "/cte/pdf/{$key}", []); 36 | } 37 | 38 | /** 39 | * @param array $payload 40 | * @return \stdClass 41 | * @throws \Exception 42 | */ 43 | public function cria($payload) 44 | { 45 | return $this->client->send("POST", "/cte", $payload); 46 | } 47 | 48 | /** 49 | * @param array $payload 50 | * @return \stdClass 51 | * @throws \Exception 52 | */ 53 | public function busca($payload) 54 | { 55 | return $this->client->send("POST", "/cte/busca", $payload); 56 | } 57 | 58 | /** 59 | * @param array $payload 60 | * @return \stdClass 61 | * @throws \Exception 62 | */ 63 | public function cancela($payload) 64 | { 65 | return $this->client->send("POST", "/cte/cancela", $payload); 66 | } 67 | 68 | /** 69 | * @param array $payload 70 | * @return \stdClass 71 | * @throws \Exception 72 | */ 73 | public function correcao($payload) 74 | { 75 | return $this->client->send("POST", "/cte/correcao", $payload); 76 | } 77 | 78 | /** 79 | * @param array $payload 80 | * @return \stdClass 81 | * @throws \Exception 82 | */ 83 | public function inutiliza($payload) 84 | { 85 | return $this->client->send("POST", "/cte/inutiliza", $payload); 86 | } 87 | 88 | /** 89 | * @param array $payload 90 | * @return \stdClass 91 | * @throws \Exception 92 | */ 93 | public function backup($payload) 94 | { 95 | return $this->client->send("POST", "/cte/backup", $payload); 96 | } 97 | 98 | /** 99 | * @param array $payload 100 | * @return \stdClass 101 | * @throws \Exception 102 | */ 103 | public function importa($payload) 104 | { 105 | return $this->client->send("POST", "/cte/importa", $payload); 106 | } 107 | 108 | /** 109 | * @param array $payload 110 | * @return \stdClass 111 | * @throws \Exception 112 | */ 113 | public function preview($payload) 114 | { 115 | return $this->client->send("POST", "/cte/preview", $payload); 116 | } 117 | 118 | /** 119 | * @param array $payload 120 | * @return \stdClass 121 | * @throws \Exception 122 | */ 123 | public function desacordo($payload) 124 | { 125 | return $this->client->send("POST", "/cte/desacordo", $payload); 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /src/CteOS.php: -------------------------------------------------------------------------------- 1 | client->send("GET", "/cteos/status", []); 14 | } 15 | 16 | /** 17 | * @param array $payload 18 | * @return \stdClass 19 | * @throws \Exception 20 | */ 21 | public function consulta($payload) 22 | { 23 | $key = self::checkKey($payload); 24 | return $this->client->send("GET", "/cteos/{$key}", []); 25 | } 26 | 27 | /** 28 | * @param array $payload 29 | * @return \stdClass 30 | * @throws \Exception 31 | */ 32 | public function pdf($payload) 33 | { 34 | $key = self::checkKey($payload); 35 | return $this->client->send("GET", "/cteos/pdf/{$key}", []); 36 | } 37 | 38 | /** 39 | * @param array $payload 40 | * @return \stdClass 41 | * @throws \Exception 42 | */ 43 | public function cria($payload) 44 | { 45 | return $this->client->send("POST", "/cteos", $payload); 46 | } 47 | 48 | /** 49 | * @param array $payload 50 | * @return \stdClass 51 | * @throws \Exception 52 | */ 53 | public function busca($payload) 54 | { 55 | return $this->client->send("POST", "/cteos/busca", $payload); 56 | } 57 | 58 | /** 59 | * @param array $payload 60 | * @return \stdClass 61 | * @throws \Exception 62 | */ 63 | public function cancela($payload) 64 | { 65 | return $this->client->send("POST", "/cteos/cancela", $payload); 66 | } 67 | 68 | /** 69 | * @param array $payload 70 | * @return \stdClass 71 | * @throws \Exception 72 | */ 73 | public function correcao($payload) 74 | { 75 | return $this->client->send("POST", "/cteos/correcao", $payload); 76 | } 77 | 78 | /** 79 | * @param array $payload 80 | * @return \stdClass 81 | * @throws \Exception 82 | */ 83 | public function inutiliza($payload) 84 | { 85 | return $this->client->send("POST", "/cteos/inutiliza", $payload); 86 | } 87 | 88 | /** 89 | * @param array $payload 90 | * @return \stdClass 91 | * @throws \Exception 92 | */ 93 | public function backup($payload) 94 | { 95 | return $this->client->send("POST", "/cteos/backup", $payload); 96 | } 97 | 98 | /** 99 | * @param array $payload 100 | * @return \stdClass 101 | * @throws \Exception 102 | */ 103 | public function importa($payload) 104 | { 105 | return $this->client->send("POST", "/cteos/importa", $payload); 106 | } 107 | 108 | /** 109 | * @param array $payload 110 | * @return \stdClass 111 | * @throws \Exception 112 | */ 113 | public function preview($payload) 114 | { 115 | return $this->client->send("POST", "/cteos/preview", $payload); 116 | } 117 | 118 | /** 119 | * @param array $payload 120 | * @return \stdClass 121 | * @throws \Exception 122 | */ 123 | public function desacordo($payload) 124 | { 125 | return $this->client->send("POST", "/cteos/desacordo", $payload); 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /src/Nfse.php: -------------------------------------------------------------------------------- 1 | client->send("POST", "/nfse", $payload); 15 | } 16 | 17 | /** 18 | * @param array $payload 19 | * @return \stdClass 20 | * @throws \Exception 21 | */ 22 | public function preview($payload) 23 | { 24 | return $this->client->send("POST", "/nfse/preview", $payload); 25 | } 26 | 27 | /** 28 | * @param array $payload 29 | * @return \stdClass 30 | * @throws \Exception 31 | */ 32 | public function pdf($payload) 33 | { 34 | $key = self::checkKey($payload); 35 | return $this->client->send("GET", "/nfse/pdf/{$key}", []); 36 | } 37 | 38 | /** 39 | * @param array $payload 40 | * @return \stdClass 41 | * @throws \Exception 42 | */ 43 | public function consulta($payload) 44 | { 45 | $key = self::checkKey($payload); 46 | return $this->client->send("GET", "/nfse/{$key}", []); 47 | } 48 | 49 | /** 50 | * @param array $payload 51 | * @return \stdClass 52 | * @throws \Exception 53 | */ 54 | public function cancela($payload) 55 | { 56 | return $this->client->send("POST", "/nfse/cancela", $payload); 57 | } 58 | 59 | /** 60 | * @param array $payload 61 | * @return \stdClass 62 | * @throws \Exception 63 | */ 64 | public function substitui($payload) 65 | { 66 | return $this->client->send("POST", "/nfse/substitui", $payload); 67 | } 68 | 69 | /** 70 | * @param array $payload 71 | * @return \stdClass 72 | * @throws \Exception 73 | */ 74 | public function busca($payload) 75 | { 76 | return $this->client->send("POST", "/nfse/busca", $payload); 77 | } 78 | 79 | /** 80 | * @param array $payload 81 | * @return \stdClass 82 | * @throws \Exception 83 | */ 84 | public function backup($payload) 85 | { 86 | return $this->client->send("POST", "/nfse/backup", $payload); 87 | } 88 | 89 | /** 90 | * @param array $payload 91 | * @return \stdClass 92 | * @throws \Exception 93 | */ 94 | public function localiza($payload) 95 | { 96 | return $this->client->send("POST", "/nfse/consulta", $payload); 97 | } 98 | 99 | /** 100 | * @param array $payload 101 | * @return \stdClass 102 | * @throws \Exception 103 | */ 104 | public function info($payload) 105 | { 106 | return $this->client->send("GET", "/nfse/info/{$payload["ibge"]}", []); 107 | } 108 | 109 | /** 110 | * @param array $payload 111 | * @return \stdClass 112 | * @throws \Exception 113 | */ 114 | public function conflito($payload) 115 | { 116 | return $this->client->send("POST", "/nfse/conflito", $payload); 117 | } 118 | 119 | /** 120 | * @return \stdClass 121 | * @throws \Exception 122 | */ 123 | public function offline() 124 | { 125 | return $this->client->send("GET", "/nfse/offline", []); 126 | } 127 | 128 | /** 129 | * @param array $payload 130 | * @return \stdClass 131 | * @throws \Exception 132 | */ 133 | public function resolve($payload) 134 | { 135 | $key = self::checkKey($payload); 136 | return $this->client->send("GET", "/nfse/resolve/{$key}", []); 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /src/Mdfe.php: -------------------------------------------------------------------------------- 1 | client->send("POST", "/mdfe", $payload); 15 | } 16 | 17 | /** 18 | * @param array $payload 19 | * @return \stdClass 20 | * @throws \Exception 21 | */ 22 | public function preview($payload) 23 | { 24 | return $this->client->send("POST", "/mdfe/preview", $payload); 25 | } 26 | 27 | /** 28 | * @return \stdClass 29 | * @throws \Exception 30 | */ 31 | public function status() 32 | { 33 | return $this->client->send("GET", "/mdfe/status", []); 34 | } 35 | 36 | /** 37 | * @param array $payload 38 | * @return \stdClass 39 | * @throws \Exception 40 | */ 41 | public function consulta($payload) 42 | { 43 | $key = self::checkKey($payload); 44 | return $this->client->send("GET", "/mdfe/{$key}", []); 45 | } 46 | 47 | /** 48 | * @param array $payload 49 | * @return \stdClass 50 | * @throws \Exception 51 | */ 52 | public function busca($payload) 53 | { 54 | return $this->client->send("POST", "/mdfe/busca", $payload); 55 | } 56 | 57 | /** 58 | * @param array $payload 59 | * @return \stdClass 60 | * @throws \Exception 61 | */ 62 | public function cancela($payload) 63 | { 64 | return $this->client->send("POST", "/mdfe/cancela", $payload); 65 | } 66 | 67 | /** 68 | * @param array $payload 69 | * @return \stdClass 70 | * @throws \Exception 71 | */ 72 | public function encerra($payload) 73 | { 74 | return $this->client->send("POST", "/mdfe/encerra", $payload); 75 | } 76 | 77 | /** 78 | * @param array $payload 79 | * @return \stdClass 80 | * @throws \Exception 81 | */ 82 | public function condutor($payload) 83 | { 84 | return $this->client->send("POST", "/mdfe/condutor", $payload); 85 | } 86 | 87 | /** 88 | * @return \stdClass 89 | * @throws \Exception 90 | */ 91 | public function offline() 92 | { 93 | return $this->client->send("GET", "/mdfe/offline", []); 94 | } 95 | 96 | /** 97 | * @param array $payload 98 | * @return \stdClass 99 | * @throws \Exception 100 | */ 101 | public function pdf($payload) 102 | { 103 | $key = self::checkKey($payload); 104 | return $this->client->send("GET", "/mdfe/pdf/{$key}", []); 105 | } 106 | 107 | /** 108 | * @param array $payload 109 | * @return \stdClass 110 | * @throws \Exception 111 | */ 112 | public function backup($payload) 113 | { 114 | return $this->client->send("POST", "/mdfe/backup", $payload); 115 | } 116 | 117 | /** 118 | * @param array $payload 119 | * @return \stdClass 120 | * @throws \Exception 121 | */ 122 | public function nfe($payload) 123 | { 124 | return $this->client->send("POST", "/mdfe/nfe", $payload); 125 | } 126 | 127 | /** 128 | * @return \stdClass 129 | * @throws \Exception 130 | */ 131 | public function abertos() 132 | { 133 | return $this->client->send("GET", "/mdfe/abertos", []); 134 | } 135 | 136 | /** 137 | * @param array $payload 138 | * @return \stdClass 139 | * @throws \Exception 140 | */ 141 | public function importa($payload) 142 | { 143 | return $this->client->send("POST", "/mdfe/importa", $payload); 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /src/Nfe.php: -------------------------------------------------------------------------------- 1 | client->send("POST", "/nfe", $payload); 13 | } 14 | 15 | // @param array $payload 16 | // @return \stdClass 17 | // @throws \Exception 18 | public function preview($payload) 19 | { 20 | return $this->client->send("POST", "/nfe/preview", $payload); 21 | } 22 | 23 | // @return \stdClass 24 | // @throws \Exception 25 | public function status() 26 | { 27 | return $this->client->send("GET", "/nfe/status", []); 28 | } 29 | 30 | // @param array $payload 31 | // @return \stdClass 32 | // @throws \Exception 33 | public function consulta($payload) 34 | { 35 | $key = self::checkKey($payload); 36 | return $this->client->send("GET", "/nfe/{$key}", []); 37 | } 38 | 39 | // @param array $payload 40 | // @return \stdClass 41 | // @throws \Exception 42 | public function busca($payload) 43 | { 44 | return $this->client->send("POST", "/nfe/busca", $payload); 45 | } 46 | 47 | // @param array $payload 48 | // @return \stdClass 49 | // @throws \Exception 50 | public function cancela($payload) 51 | { 52 | return $this->client->send("POST", "/nfe/cancela", $payload); 53 | } 54 | 55 | // @param array $payload 56 | // @return \stdClass 57 | // @throws \Exception 58 | public function correcao($payload) 59 | { 60 | return $this->client->send("POST", "/nfe/correcao", $payload); 61 | } 62 | 63 | // @param array $payload 64 | // @return \stdClass 65 | // @throws \Exception 66 | public function inutiliza($payload) 67 | { 68 | return $this->client->send("POST", "/nfe/inutiliza", $payload); 69 | } 70 | 71 | // @param array $payload 72 | // @return \stdClass 73 | // @throws \Exception 74 | public function pdf($payload) 75 | { 76 | $key = self::checkKey($payload); 77 | return $this->client->send("GET", "/nfe/pdf/{$key}", []); 78 | } 79 | 80 | // @param array $payload 81 | // @return \stdClass 82 | // @throws \Exception 83 | public function etiqueta($payload) 84 | { 85 | $key = self::checkKey($payload); 86 | return $this->client->send("GET", "/nfe/pdf/etiqueta/{$key}", []); 87 | } 88 | 89 | // @param array $payload 90 | // @return \stdClass 91 | // @throws \Exception 92 | public function simples($payload) 93 | { 94 | $key = self::checkKey($payload); 95 | return $this->client->send("GET", "/nfe/pdf/simples/{$key}", []); 96 | } 97 | 98 | // @param array $payload 99 | // @return \stdClass 100 | // @throws \Exception 101 | public function manifesta($payload) 102 | { 103 | return $this->client->send("POST", "/nfe/manifesta", $payload); 104 | } 105 | 106 | // @param array $payload 107 | // @return \stdClass 108 | // @throws \Exception 109 | public function backup($payload) 110 | { 111 | return $this->client->send("POST", "/nfe/backup", $payload); 112 | } 113 | 114 | // @param array $payload 115 | // @return \stdClass 116 | // @throws \Exception 117 | public function download($payload) 118 | { 119 | $key = self::checkKey($payload); 120 | return $this->client->send("GET", "/nfe/download/{$key}", []); 121 | } 122 | 123 | // @param array $payload 124 | // @return \stdClass 125 | // @throws \Exception 126 | public function recebidas($payload) 127 | { 128 | return $this->client->send("POST", "/nfe/recebidas", $payload); 129 | } 130 | 131 | // @param array $payload 132 | // @return \stdClass 133 | // @throws \Exception 134 | public function interessado($payload) 135 | { 136 | return $this->client->send("POST", "/nfe/interessado", $payload); 137 | } 138 | 139 | // @param array $payload 140 | // @return \stdClass 141 | // @throws \Exception 142 | public function importa($payload) 143 | { 144 | return $this->client->send("POST", "/nfe/importa", $payload); 145 | } 146 | 147 | // @param array $payload 148 | // @return \stdClass 149 | // @throws \Exception 150 | public function comprovante($payload) 151 | { 152 | return $this->client->send("POST", "/nfe/comprovante", $payload); 153 | } 154 | 155 | // @param array $payload 156 | // @return \stdClass 157 | // @throws \Exception 158 | public function cadastro($payload) 159 | { 160 | return $this->client->send("POST", "/nfe/cadastro", $payload); 161 | } 162 | } 163 | -------------------------------------------------------------------------------- /.sensiolabs.yml: -------------------------------------------------------------------------------- 1 | global_exclude_dirs: 2 | - vendor 3 | - examples 4 | - test 5 | 6 | exclude_patterns: 7 | 8 | rules: 9 | composer.apc_class_loader_should_be_enabled: 10 | enabled: true 11 | composer.dependencies_not_installable: 12 | enabled: true 13 | composer.invalid_file: 14 | enabled: true 15 | composer.security_issue_in_composer: 16 | enabled: true 17 | composer.unfixed_dependency_version: 18 | enabled: true 19 | composer.warning: 20 | enabled: true 21 | git.user_specific_ignored_file: 22 | enabled: false 23 | php.absolute_path_present: 24 | enabled: true 25 | allowed_paths: [/dev, /etc, /proc] 26 | php.bad_mutator_method_name_for_boolean_property: 27 | enabled: true 28 | php.class_too_long: 29 | enabled: true 30 | max_length: 500 31 | threshold: 5 32 | php.commented_out_code: 33 | enabled: true 34 | php.contaminant_third_party_component_license: 35 | enabled: true 36 | php.debug_statements: 37 | enabled: true 38 | php.dynamically_change_configuration: 39 | enabled: true 40 | php.file_contains_more_than_one_class: 41 | enabled: true 42 | php.for_loop_uses_test_function: 43 | enabled: true 44 | php.method_too_long: 45 | enabled: true 46 | max_length: 50 47 | threshold: 5 48 | php.missing_use_statement: 49 | enabled: true 50 | php.neglected_tests: 51 | enabled: true 52 | php.object_parameter_not_type_hinted: 53 | enabled: true 54 | php.php_magic_methods: 55 | enabled: true 56 | php.php_syntax_error: 57 | enabled: true 58 | php.too_many_files_per_folder_for_performance: 59 | enabled: true 60 | max_count: 10000 61 | php.too_permissive_file_permissions: 62 | enabled: true 63 | allowed_dirs: [bin, scripts] 64 | php.unreachable_code: 65 | enabled: true 66 | php.unused_local_variable_or_private_member: 67 | enabled: true 68 | php.unused_use_statement: 69 | enabled: true 70 | php.use_deprecated_function: 71 | enabled: true 72 | php.use_exit_function: 73 | enabled: true 74 | php.use_global_variable_or_function: 75 | enabled: true 76 | php.use_php_ereg_function: 77 | enabled: true 78 | php.use_php_eval_function: 79 | enabled: true 80 | php.use_php_sleep_function: 81 | enabled: true 82 | symfony.acme_bundle_found: 83 | enabled: true 84 | symfony.app.cache_or_log_file_in_repository: 85 | enabled: true 86 | symfony.app.confidential_parameters_file_present_in_repository: 87 | enabled: true 88 | symfony.app.first_level_service: 89 | enabled: true 90 | symfony.app.sensitive_data_found_in_application_configuration: 91 | enabled: true 92 | symfony.application_not_bootable: 93 | enabled: true 94 | symfony.configuration.yaml_syntax_error: 95 | enabled: true 96 | symfony.controller.action_method_too_long: 97 | enabled: true 98 | max_length: 20 99 | threshold: 10 100 | symfony.controller.get_action_mutates_resource: 101 | enabled: true 102 | symfony.controller.missing_redirect_after_post: 103 | enabled: true 104 | symfony.controller.non_action_public_method_in_controller_class: 105 | enabled: true 106 | symfony.controller.too_many_actions_per_controller: 107 | enabled: true 108 | max_count: 10 109 | threshold: 5 110 | symfony.controller.too_many_template_variables: 111 | enabled: true 112 | max_count: 6 113 | threshold: 5 114 | symfony.dependency_injection.no_container_as_parameter: 115 | enabled: true 116 | symfony.dependency_injection.no_entity_manager_as_parameter: 117 | enabled: true 118 | symfony.dependency_injection.use_dir_file_constant: 119 | enabled: true 120 | symfony.exceptions_enabled_in_production: 121 | enabled: true 122 | symfony.form.form_type_not_in_type_form_folder: 123 | enabled: true 124 | symfony.include_statement_used: 125 | enabled: true 126 | symfony.inject_request_service: 127 | enabled: true 128 | symfony.obvious_csrf_key: 129 | enabled: true 130 | symfony.print_statements: 131 | enabled: true 132 | symfony.request.session_cookie_default_name: 133 | enabled: true 134 | symfony.request.use_create_from_globals: 135 | enabled: true 136 | symfony.routing.action_not_restricted_by_method: 137 | enabled: true 138 | symfony.routing.route_references_non_existent_action: 139 | enabled: true 140 | symfony.routing.route_resource_not_loadable: 141 | enabled: true 142 | symfony.security.insecure_password_hashing_algorithm: 143 | enabled: true 144 | symfony.security.throw_access_denied_http_exception: 145 | enabled: true 146 | symfony.templating.too_many_esi_inclusions: 147 | enabled: true 148 | symfony.twig_not_bootable: 149 | enabled: true 150 | symfony.use_php_database_function: 151 | enabled: true 152 | symfony.use_php_response_function: 153 | enabled: true 154 | symfony.use_php_session_function: 155 | enabled: true 156 | symfony.use_super_globals: 157 | enabled: true 158 | symfony.verbose_logging_in_production: 159 | enabled: true 160 | symfony.version.end_of_life: 161 | enabled: true 162 | symfony.version.latest_stable: 163 | enabled: true 164 | symfony.version.out_of_maintenance: 165 | enabled: true 166 | symfony.web.contains_php_files: 167 | enabled: true 168 | symfony.web.web_bundle_folder_present_in_repository: 169 | enabled: true 170 | symfony.web_config_should_not_be_present: 171 | enabled: true 172 | task_fixme_comment: 173 | enabled: true 174 | task_todo_comment: 175 | enabled: true 176 | task_xxx_comment: 177 | enabled: true 178 | third_party.use_deprecated_class: 179 | enabled: true 180 | third_party.use_deprecated_service: 181 | enabled: true 182 | xml.syntax_error: 183 | enabled: true 184 | --------------------------------------------------------------------------------