PHP code example of andmarruda / laravel-ibge

1. Go to this page and download the library: Download andmarruda/laravel-ibge 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/ */

    

andmarruda / laravel-ibge example snippets


use Andmarruda\LaravelIbge\Facades\Ibge;

$pesquisas = Ibge::pesquisas();
$ocorrencias = Ibge::ocorrencias('CD');
$censo2010 = Ibge::ocorrencia('CD', 2010);
$metas = Ibge::metas(6);
$ficha = Ibge::fichaMetodologica('6-1-1');

use Andmarruda\LaravelIbge\Ibge;
use Andmarruda\LaravelIbge\Facades\Ibge as IbgeFacade;

$ibge = app(Ibge::class);

$pesquisas = $ibge->pesquisas();
$ocorrencias = $ibge->ocorrencias('CD');
$censo2010 = $ibge->ocorrencia('CD', 2010);
$metas = $ibge->metas(6);
$ficha = $ibge->fichaMetodologica('6-1-1');

$pesquisas = IbgeFacade::pesquisas();

use Illuminate\Support\Facades\Schedule;

Schedule::command('ibge:sync')
    ->monthly()
    ->withoutOverlapping();

use Andmarruda\LaravelIbge\Models\OdsIndicador;
use Andmarruda\LaravelIbge\Models\OdsMeta;
use Andmarruda\LaravelIbge\Models\Pesquisa;
use Andmarruda\LaravelIbge\Models\PesquisaOcorrencia;

$pesquisas = Pesquisa::with('ocorrencias')->get();
$indicadores = OdsIndicador::with('meta')->get();

$this->app->singleton(
    \Andmarruda\LaravelIbge\Contracts\MetadataGateway::class,
    MinhaFonteDeMetadados::class,
);
bash
php artisan vendor:publish --tag=ibge-config
bash
php artisan vendor:publish --tag=ibge-migrations
php artisan migrate
bash
php artisan migrate
bash
php artisan ibge:sync
bash
php artisan queue:work --queue=ibge,default