PHPackages                             allgood/indices-bcb - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. allgood/indices-bcb

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

allgood/indices-bcb
===================

Consulta índices financeiros no webservice do Banco Central do Brasil

11491PHP

Since May 24Pushed 4y ago1 watchersCompare

[ Source](https://github.com/allgood/indices-bcb)[ Packagist](https://packagist.org/packages/allgood/indices-bcb)[ RSS](/packages/allgood-indices-bcb/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Indices BCB
===========

[](#indices-bcb)

Este projeto auxilia na obtenção de índices financeiros junto ao Banco Central do Brasil e a aplicação dele sobre valores.

Como usar:
----------

[](#como-usar)

### Instalação

[](#instalação)

Para instalar a biblioteca através do composer:

```
composer require allgood/indices-bcb

```

### Uso das funções

[](#uso-das-funções)

Para usar a biblioteca instalada pelo composer:

```
require_once "vendor/autoload.php"

use \Allgood\IndicesBCB\IndiceBCB;

$i = new IndiceBCB();

// obtém o último valor da série:
$ultimoIndice = $i->getUltimoValor();

// obtém os últimos 12 valores da série:
$ultimosDoze = $i->getUltimosDozeValores();

// corrige valor para um período específico
$corrigido = $i->reajustaValor(100,"01/05/2020","01/04/2021");

// indice acumulado em um período
$indice = $i->getIndiceAcumulado("01/05/2020","01/04/2021");

// percentual acumulado em um período
$percentual = $i->getPercentualAcumulado("01/05/2020","01/04/2021");

// indice acumulado referente aos últimos 12 valores:
$indice = IndiceBCB::getIndiceAcumuladoDoPeriodo($i->getUltimosDozeValores());

```

### Índices suportados

[](#índices-suportados)

As funções aceitam qualquer índice fornecido pela API do Banco Central com a única restrição de que seja um índice de percentual mensal, bastando informar o código do índice no [Sistema Gerenciador de Séries Temporais](https://www4.bcb.gov.br/pec/series/port/aviso.asp).

Alguns códigos estão predefinidos em constantes para facilitar:

ConstanteCodigoÍndice`IndiceBCB::BCB_INPC`188INPC do IBGE`IndiceBCB::BCB_IGPM`28655IGP-M da FGV`IndiceBCB::BCB_IGPDI`190IGP-DI da FGV`IndiceBCB::BCB_IPCBR`191IPC Brasil da FGV`IndiceBCB::BCB_IPCSP`193IPC-SP do IBGE`IndiceBCB::BCB_IPCA`433IPCA do IBGEComo Default é utilizado o IGP-M da Fundação Getúlio Vargas.

### A melhor documentação é o Código Fonte

[](#a-melhor-documentação-é-o-código-fonte)

Verificar o [arquivo fonte](src/Allgood/IndicesBCB/IndiceBCB.php) para mais detalhes sobre as funções.

Licença
-------

[](#licença)

Todo o código deste projeto está licensiado sob a GNU Lesser General Public License versão 3.

Pode ser utilizado inalterado em qualquer projeto fechado ou open source, alterações efetuadas precisam ser fornecidas em código aberto aos usuários do sistema.

Facilitou sua vida?
-------------------

[](#facilitou-sua-vida)

Se o código do projeto ajudou você em uma tarefa complexa, considere fazer uma doação ao autor pelo PIX abaixo.

[![image](https://user-images.githubusercontent.com/6070736/116247400-317e3680-a741-11eb-9434-9f226eec39b5.png)](https://user-images.githubusercontent.com/6070736/116247400-317e3680-a741-11eb-9434-9f226eec39b5.png)

Chave Pix: 80fd8916-1131-4844-917e-2732eaa2ba74

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity29

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/59323aa32cf1266f6547b146867c557a3e76ce1b4d1ff3cf07836cb9ef179c6d?d=identicon)[allgood](/maintainers/allgood)

---

Top Contributors

[![allgood](https://avatars.githubusercontent.com/u/6070736?v=4)](https://github.com/allgood "allgood (8 commits)")

### Embed Badge

![Health badge](/badges/allgood-indices-bcb/health.svg)

```
[![Health](https://phpackages.com/badges/allgood-indices-bcb/health.svg)](https://phpackages.com/packages/allgood-indices-bcb)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
