PHP code example of luizfabianonogueira / navi-api

1. Go to this page and download the library: Download luizfabianonogueira/navi-api 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/ */

    

luizfabianonogueira / navi-api example snippets


    
    return [
        // other providers...
        LuizFabianoNogueira\NaviAPI\NaviAPIServiceProvider::class, 
    ];
    



namespace App\Http\Controllers;

use LuizFabianoNogueira\NaviAPI\NaviAPIService;

class HomeController extends Controller
{
    public function index()
    {
        $naviAPIService = new NaviAPIService();

        // Exemplo de consulta de CEP
        $cep = $naviAPIService->cep('#####-###');
        dump($cep);

        // Exemplo de consulta de CPF
        $cpf = $naviAPIService->cpf('###.###.###-##');
        dump($cpf);

        // Exemplo de consulta de CNPJ
        $cnpj = $naviAPIService->cnpj('##.###.###/####-##');
        dump($cnpj);

        return view('home');
    }
}
bash
    php artisan vendor:publish --tag=navi-api-config
    
bash
    php artisan config:cache