PHPackages                             egcservices/iugu-php-sdk - 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. [Payment Processing](/categories/payments)
4. /
5. egcservices/iugu-php-sdk

ActiveLibrary[Payment Processing](/categories/payments)

egcservices/iugu-php-sdk
========================

Biblioteca não oficial de integração com a API da Iugu

2.0(4y ago)11.3k2MITPHPPHP ^7.4|^8.0

Since Jul 14Pushed 4y agoCompare

[ Source](https://github.com/elsongabriel/iugu-php-sdk)[ Packagist](https://packagist.org/packages/egcservices/iugu-php-sdk)[ RSS](/packages/egcservices-iugu-php-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (6)Versions (6)Used By (2)

iugu-php-sdk
============

[](#iugu-php-sdk)

Biblioteca que realiza integração com a API da [Iugu](http://www.iugu.com)

[![StyleCI](https://camo.githubusercontent.com/0b0fe1d2a74d634444c26f4147182f3f5623c41fda60dab3fa2aae815c2c741a/68747470733a2f2f7374796c6563692e696f2f7265706f732f3134303930323034302f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/140902040)[![Maintainability](https://camo.githubusercontent.com/eb8f7fb22b8758040c4cf59785d78dc7c787b13a5e5d82229ee1cdf1f16189fc/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f64346536366639386164303533396530623635642f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/bubbstore/iugu-php-sdk/maintainability)

Instalação via composer
-----------------------

[](#instalação-via-composer)

```
$ composer require egcservices/iugu-php-sdk
```

Serviços
--------

[](#serviços)

Este SDK suporta os seguintes serviços:

- [Clientes](https://dev.iugu.com/reference#testinput-2)
- [Cobrança direta](https://dev.iugu.com/reference#cobranca-direta)
- [Faturas](https://dev.iugu.com/reference#criar-fatura)
- [Métodos de pagamento](https://dev.iugu.com/reference#testinput-3)

[Referência da API](https://dev.iugu.com/reference)

### Configuração

[](#configuração)

Para utilizar este SDK, será necessário utilizar seu token de acesso de sua conta Iugu.

```
use bubbstore\Iugu;
use bubbstore\Iugu\Exceptions\IuguException;
use bubbstore\Iugu\Exceptions\IuguValidationException;

$iugu = new Iugu('SEU_TOKEN');
```

### Clientes

[](#clientes)

#### Criar cliente

[](#criar-cliente)

```
$customer = $iugu->customer()->create([
    'name'  => 'User Test',
    'email' => 'test@test.com',
]);

// Imprime o ID do cliente
echo $customer['id'];
```

#### Atualizar cliente

[](#atualizar-cliente)

```
$customer = $iugu->customer()->update('ID_CLIENTE', [
    'name' => 'John'
]);
```

#### Buscar cliente

[](#buscar-cliente)

```
$customer = $iugu->customer()->find('ID_CLIENTE');

var_dump($customer);
```

#### Excluir cliente

[](#excluir-cliente)

```
$iugu->customer()->delete('ID_CLIENTE');
```

### Cobranças diretas

[](#cobranças-diretas)

#### Criar cobrança com boleto bancário

[](#criar-cobrança-com-boleto-bancário)

```
$charge = $iugu->charge()->create([
            'method'   => 'bank_slip',
            'email'    => 'test@test.com',
            'order_id' => uniqid(),
            'payer'    => [
                'cpf_cnpj'     => '65634052076',
                'name'         => 'User Test',
                'phone_prefix' => '11',
                'phone'        => '111111111',
                'email'        => 'test@test.com',
                'address'      => [
                    'street'   => 'Foo Bar',
                    'number'   => '123',
                    'district' => 'Foo',
                    'city'     => 'Foo',
                    'state'    => 'SP',
                    'zip_code' => '14940000',
                ],
            ],
            'items' => [
                [
                    'description' => 'Item 1',
                    'quantity'    => 1,
                    'price_cents' => 1000
                ],
                [
                    'description' => 'Item 2',
                    'quantity'    => 2,
                    'price_cents' => 2000
                ],
            ],
        ]);
```

#### Realizar pagamento de uma fatura com cartão

[](#realizar-pagamento-de-uma-fatura-com-cartão)

```
$charge = $iugu->charge()->create([
    'invoice_id' => '12345678',
    'token'      => '0000000000000000' // Token gerado através da lib iugu.js
]);
```

Faturas
-------

[](#faturas)

#### Criar fatura

[](#criar-fatura)

```
$invoice = $iugu->invoice()->create([
    'order_id'         => uniqid(),
    'email'            => 'test@test.com',
    'due_date'         => '2018-07-14',
    'notification_url' => 'https://webhook.site/08703bf2-d408-4f4c-b91c-0bc8e14352b2',
    'fines'            => false,
    'per_day_interest' => false,
    'discount_cents'   => 500,
    'ignore_due_email' => true,
    'payable_with'     => 'bank_slip',
    'items' => [
        [
            'description' => 'Item 1',
            'quantity'    => 1,
            'price_cents' => 1000
        ],
        [
            'description' => 'Item 2',
            'quantity'    => 2,
            'price_cents' => 2000
        ],
        [
            'description' => 'Frete',
            'quantity'    => 1,
            'price_cents' => 1000
        ],
    ],
    'payer' => [
        'cpf_cnpj'     => '65634052076',
        'name'         => 'User Test',
        'phone_prefix' => '11',
        'phone'        => '11111111',
        'email'        => 'test@test.com',
        'address'      => [
            'street'   => 'Foo Bar',
            'number'   => '123',
            'district' => 'Foo',
            'city'     => 'Foo',
            'state'    => 'SP',
            'zip_code' => '14940000',
        ],
    ],
]);

// Imprime o ID da fatura
echo $invoice['id'];
```

#### Capturar fatura

[](#capturar-fatura)

```
$iugu->invoice()->capture('ID_FATURA');
```

#### Buscar fatura

[](#buscar-fatura)

```
$iugu->invoice()->find('ID_FATURA');
```

#### Reembolsar fatura

[](#reembolsar-fatura)

```
$iugu->invoice()->refund('ID_FATURA');
```

#### Cancelar fatura

[](#cancelar-fatura)

```
$iugu->invoice()->cancel('ID_FATURA');
```

Métodos de pagamento
--------------------

[](#métodos-de-pagamento)

#### Criar método de pagamento

[](#criar-método-de-pagamento)

```
$payment = $iugu->paymentMethod()->create('ID_CLIENTE', [
    'description' => 'Cartão de Crédito',
    'token'       => '123456',
]);

// Imprime o ID do pagamento
echo $payment['id'];
```

#### Atualizar método de pagamento

[](#atualizar-método-de-pagamento)

```
$iugu->paymentMethod()->update('ID_CLIENTE', 'ID_METODO_PAGAMENTO', [
    'description' => 'Outra description',
]);
```

#### Buscar método de pagamento

[](#buscar-método-de-pagamento)

```
$iugu->paymentMethod()->find('ID_CLIENTE', 'ID_METODO_PAGAMENTO');
```

#### Excluir método de pagamento

[](#excluir-método-de-pagamento)

```
$iugu->paymentMethod()->delete('ID_CLIENTE', 'ID_METODO_PAGAMENTO');
```

Testando
--------

[](#testando)

```
$ composer test
```

Segurança
---------

[](#segurança)

Se você descobrir quaisquer problemas relacionados à segurança, envie um e-mail para  em vez de usar as issues.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 90.9% 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.

###  Release Activity

Cadence

Every ~351 days

Total

4

Last Release

1804d ago

Major Versions

v1.0.2 → 2.02021-06-01

PHP version history (2 changes)v1.0.0PHP ~5.6|~7.0

2.0PHP ^7.4|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/24e99729583abb961401bfb8e2d3f8f080469273f42105495961056890cc81a9?d=identicon)[elsoncosta](/maintainers/elsoncosta)

---

Top Contributors

[![lucascolette](https://avatars.githubusercontent.com/u/829381?v=4)](https://github.com/lucascolette "lucascolette (20 commits)")[![danfsd](https://avatars.githubusercontent.com/u/4552181?v=4)](https://github.com/danfsd "danfsd (1 commits)")[![elsongabriel](https://avatars.githubusercontent.com/u/7812282?v=4)](https://github.com/elsongabriel "elsongabriel (1 commits)")

---

Tags

phppaymentphp80iuguinboud

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/egcservices-iugu-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/egcservices-iugu-php-sdk/health.svg)](https://phpackages.com/packages/egcservices-iugu-php-sdk)
```

###  Alternatives

[omalizadeh/laravel-multi-payment

A driver-based laravel package for online payments via multiple gateways

491.1k](/packages/omalizadeh-laravel-multi-payment)

PHPackages © 2026

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