PHP code example of kattatzu / sbif

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

    

kattatzu / sbif example snippets


use Kattatzu/Sbif/Sbif;

$sbif = new Sbif('SBIF API KEY');
// o
$sbif = new Sbif;
$sbif->apiKey('SBIF API KEY');

echo $sbif->getDollar('2017-04-30');
//664.0

$date = Carbon::today();

$sbif->getDollar($date);
$sbif->getEuro($date);
$sbif->getUTM($date);
$sbif->getUF($date);
$sbif->getIPC($date);
// NOTA: El IPC solo tiene valor hasta el mes anterior

// Si no envias una fecha se toma la fecha actual
$sbif->getDollar();

$sbif->getIndicator(Sbif::IND_EURO, $date);

Sbif::IND_UF
Sbif::IND_UTM
Sbif::IND_DOLLAR
Sbif::IND_EURO
Sbif::IND_IPC

var_dump($sbif->get("/resultados/2009/12/instituciones"));

object(stdClass){
    "DescripcionesCodigosDeInstituciones": [
        "0" => {
            "CodigoInstitucion": "001",
            "NombreInstitucion": "BANCO DE CHILE"
        },
        "1" => {
            "CodigoInstitucion": "014",
            "NombreInstitucion": "SCOTIABANK CHILE"
        },
        ...
    ]
}

$info = $sbif->getInstitutionData('001');
echo $info->name;
// BANCO DE CHILE

$info = $sbif->getInstitutionData('001')->toArray();
var_dump($info);

[
  "code" => "001",
  "name" => "BANCO DE CHILE",
  "swift_code" => "BCHI CL RM",
  "rut" => "97.004.000-5",
  "address" => "AHUMADA 251",
  "phone" => "(56-2) 653 11 11",
  "website" => "www.bancochile.cl",
  "public_contact" => "Pamela Valdivia",
  "public_address" => "Huérfanos 980, 8º Piso, Santiago",
  "public_phone" => "(56-2) 653 06 73",
  "branches" => 403,
  "employees" => 11426,
  "publication_date" => "2017-05-01",
  "cashiers" => 1412
]

use Kattatzu\Sbif\Institution;

var_dump((new Institution)->getInstitutions());

[
  "001" => "Banco de Chile",
  "009" => "Banco Internacional",
  "014" => "Scotiabank Chile",
  "016" => "Banco de Credito E Inversiones",
  "028" => "Banco Bice",
  "031" => "HSBC Bank (chile)",
  "037" => "Banco Santander-chile",
  "039" => "Itaú Corpbanca",
  "049" => "Banco Security",
  "051" => "Banco Falabella",
  "053" => "Banco Ripley",
  "054" => "Rabobank Chile",
  "055" => "Banco Consorcio",
  "056" => "Banco Penta",
  "504" => "Banco BBVA",
  "059" => "Banco BTG Pactual Chile",
  "012" => "Banco del Estado de Chile",
  "017" => "Banco Do Brasil S.A.",
  "041" => "JP Morgan Chase Bank, N. A.",
  "043" => "Banco de la Nacion Argentina",
  "045" => "The Bank of Tokyo-mitsubishi UFJ",
  "060" => "China Construction Bank"
]

'providers' => [
    ...
    Kattatzu\Sbif\Providers\SbifServiceProvider::class,
],
'aliases' => [
    ...
    'Sbif' => Kattatzu\Sbif\Facades\SbifFacade::class,
]

Sbif::getDollar();
Sbif::getUTM('2017-06-30');
Sbif::getUF(Carbon::today());

sbif_dollar();
sbif_euro('2017-06-30');
sbif_utm(Carbon::yesterday());
sbif_uf(Carbon::now()->subMonth(1));
sbif_ipc();
sbif_institution('001')->name;
sbif_institutions();
shell
php artisan vendor:publish --provider="Kattatzu\Sbif\Providers\SbifServiceProvider"