diff --git a/Examples/WhatsApp.php b/Examples/WhatsApp.php deleted file mode 100644 index 965b1ae..0000000 --- a/Examples/WhatsApp.php +++ /dev/null @@ -1,32 +0,0 @@ - "SEU TOKEN AQUI", - "SecretKey" => "SEU SECRETKEY AQUI", - "PublicToken" => "SEU PUBLICTOKEN AQUI", - "DeviceToken" => "SEU DEVICETOKEN AQUI", - "body" => [ - "number" => "5531994359434", - "text" => "🟢 Bem vindo ao APIBrasil" - ] - ]); - - return $response; - - } - -} - -print_r(Example::sendText()); \ No newline at end of file diff --git a/README.md b/README.md index 8e4a6f0..e22186e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # SDK PHP - APIGratis by API BRASIL 🚀 -This package is free and can be used for API Brazil website functions +Conjunto de API, para desenvolvedores. + +_Transforme seus projetos em soluções inteligentes com nossa API. Com recursos como API do WhatsApp, geolocalização, rastreamento de encomendas, verificação de CPF/CNPJ e mais, você pode criar soluções eficientes e funcionais. Comece agora._ + [![latest stable version](https://poser.pugx.org/jhowbhz/apigratis-sdk-php/v/stable.svg)](https://packagist.org/packages/jhowbhz/apigratis-sdk-php) [![license mit](https://poser.pugx.org/jhowbhz/apigratis-sdk-php/license.svg)](https://packagist.org/packages/jhowbhz/apigratis-sdk-php) @@ -26,14 +29,15 @@ https://packagist.org/packages/jhowbhz/apigratis-sdk-php | Up | Services available | Description | Free | Beta | Stable | ------|-------------------------------|-------------------|---------| ------------------------- | ------------------------- | -| ✅ | WhatsAppService | Free in WhatsApp API. | ✅ | ✅ | ✅ | -| ✅ | Receita Data CNPJ | API CNPJ or data of Receita Federal BR. | ✅ | ✅ | ✅ | -| ✅ | Receita Data CPF | API CPF or data of SERASA Brazil. | ⌛ | ⌛ | ⌛ | -| ✅ | CorreiosService | API CEP or Tracker packages, correios Brazil. | ✅ | ✅ | ✅ | -| ✅ | VehiclesService | API Plate get infos vehicle. | ✅ | ✅ | ✅ | -| ✅ | FipeService | FIPE value the velhicle plate. | ✅ | ✅ | ✅ | - -## Install package with composer +| ✅ | WhatsAppService | API do WhatsApp Gratuita. | ✅ | ✅ | ✅ | +| ✅ | Receita Data CNPJ | API Dados CNPJ Receita. | ✅ | ✅ | ✅ | +| ✅ | Receita Data CPF | API Dados de CPF Serasa. | ⌛ | ⌛ | ⌛ | +| ✅ | CorreiosService | API Busca encomendas Correios Brazil. | ✅ | ✅ | ✅ | +| ✅ | CEPLocation | API CEP Geolocation + IBGE Brazil. | ✅ | ✅ | ✅ | +| ✅ | VehiclesService | API Placa Dados. | ✅ | ✅ | ✅ | +| ✅ | FipeService | API Placa FIPE. | ✅ | ✅ | ✅ | + +## Instalando pacote com o composer ```bash composer require jhowbhz/apigratis-sdk-php ``` @@ -152,7 +156,6 @@ $address = Service::Correios("address", [ var_dump($address); die; ``` - ## CNPJService - Obtenha dados de endereço através de um CNPJ de várias formas - Lista CNAES @@ -181,3 +184,26 @@ $cnpj = Service::CNPJ("cnpj", [ var_dump($cnpj); die; ``` + +## CEPLocation +- Com essa API é possível obter dados de coordenadas LAT e LONG e código IBGE apenas com o CEP + +```php + "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....", + "SecretKey" => "f87eb607-a8cc-43ea-b439...", + "PublicToken" => "3f279a5c-bfbc-11ed-afa1...", + "DeviceToken" => "d019580b-3c8c-40e3-b9a0....", + "body" => [ + "cep" => "32146057", + ] +]); + +var_dump($cnpj); +die; +``` diff --git a/src/Service.php b/src/Service.php index 8b1b63e..5a67cd8 100644 --- a/src/Service.php +++ b/src/Service.php @@ -123,4 +123,34 @@ public static function CNPJ(String $action = '', Array $data = []) { } + public static function CEP(String $action = '', Array $data = []) { + + try { + + $base_uri = "https://cluster.apigratis.com/api/v1/cep/".$action; + $method = $data['method'] ?? 'POST'; + + $headers = [ + "Content-Type" => "application/json", + "Accept" => "application/json", + "Authorization" => "Bearer ".$data['Bearer'], + "SecretKey" => $data['SecretKey'] ?? '', + "PublicToken" => $data['PublicToken'] ?? '', + "DeviceToken" => $data['DeviceToken'] ?? '', + ]; + + $body = $data['body'] ?? []; + + $response = self::defaultRequest($method, $base_uri, $action, $headers, $body); + return $response; + + } catch (ClientException $e) { + + $response = $e->getResponse(); + return json_decode((string)($response->getBody()->getContents())); + + } + + } + }