PHPackages                             ailos/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. [API Development](/categories/api)
4. /
5. ailos/sdk

ActiveLibrary[API Development](/categories/api)

ailos/sdk
=========

Este SDK foi desenvolvido para facilitar a integração com os serviços da Cooperativa Ailos, oferecendo uma interface simples, segura e eficiente para desenvolvedores PHP.

v1.1.1(1w ago)322↓100%2MITPHPPHP ^8.5CI passing

Since Mar 8Pushed 1w ago1 watchersCompare

[ Source](https://github.com/senna73/ailos-sdk)[ Packagist](https://packagist.org/packages/ailos/sdk)[ RSS](/packages/ailos-sdk/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (3)Versions (4)Used By (0)

Ailos SDK
=========

[](#ailos-sdk)

[![Packagist](https://camo.githubusercontent.com/6cc6842aa909e761c7df4d60cb557b248f448f66681451c6a60cff4aa2b6d5a0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61696c6f732f73646b)](https://packagist.org/packages/ailos/sdk)[![PHP Version](https://camo.githubusercontent.com/f9dab509b766874e090f4122a99762a7f0b08ded23a495e18701a9a4937d036d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e352d626c75652e737667)](https://www.php.net/)[![License](https://camo.githubusercontent.com/e72a9a7cb68a490c7607dbfa759e0fe7d6053f3d43030ae52b93afdcd8947858/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f56696e6963697573446553656e6e612f61696c6f732d73646b2d706870)](LICENSE)![Maintenance](https://camo.githubusercontent.com/23cea48818f21df9e3f7edc5aa8996f792b43290781b5a5a84434807116386f3/68747470733a2f2f696d672e736869656c64732e696f2f6d61696e74656e616e63652f7965732f32303236)[![Last Commit](https://camo.githubusercontent.com/7585c33d29c68ea98a436188537a38046022d3696bcc3fdde7fe57c8df15d159/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f56696e6963697573446553656e6e612f61696c6f732d73646b2d706870)](https://github.com/ViniciusDeSenna/ailos-sdk-php/commits)[![Issues](https://camo.githubusercontent.com/20fff2730216a2b3a24df1d4dbe5bd7ba7314bd05cb00819477903bbca9c61cd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f56696e6963697573446553656e6e612f61696c6f732d73646b2d706870)](https://github.com/ViniciusDeSenna/ailos-sdk-php/issues)[![Code Style](https://camo.githubusercontent.com/31a738873c5fd0723110e7a965d3d33f8b405652246e9780a8b1c9185a7dd7a0/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f64655f7374796c652d5053522d2d31322d626c7565)](https://www.php-fig.org/psr/psr-12/)[![GitHub forks](https://camo.githubusercontent.com/bdcee4116cc77e954698f30c8039fa43024ac0efc8f83283de62ab7032b1259a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f56696e6963697573446553656e6e612f61696c6f732d73646b2d7068703f7374796c653d736f6369616c)](https://camo.githubusercontent.com/bdcee4116cc77e954698f30c8039fa43024ac0efc8f83283de62ab7032b1259a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f56696e6963697573446553656e6e612f61696c6f732d73646b2d7068703f7374796c653d736f6369616c)[![GitHub Stars](https://camo.githubusercontent.com/54256164caa414cec4d284baaaf5ef90c8ac757d4d2222f890bc3dd618c4af94/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f56696e6963697573446553656e6e612f61696c6f732d73646b2d7068703f7374796c653d736f6369616c)](https://github.com/ViniciusDeSenna/ailos-sdk-php/stargazers)

---

[![Ailos SDK PHP](https://private-user-images.githubusercontent.com/110927988/469300240-de553609-4521-43e4-8f74-2efdfff8ecd7.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3Lmdpd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hd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDMyNFQwMzQwMDBaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0zODU2OTljZGJhNjBjN2QwZWZiYjg1NmM3Y2ExZjZmYTRmODgyZjVlMzk1Yjk3NDE5ZjAwMGEwNjk1ZjNjMzg3JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.6JnGKIXBSV9PHPgRjQCRmR-W13afHTseHzHzdcJVdPU)Este SDK foi desenvolvido para facilitar a integração com os serviços da **Cooperativa Ailos**, oferecendo uma interface simples, segura e eficiente para desenvolvedores PHP.

---

Requisitos
----------

[](#requisitos)

- PHP `^8.5`
- Extensão `curl` habilitada

---

Instalação
----------

[](#instalação)

```
composer require ailos/sdk
```

---

Ambientes
---------

[](#ambientes)

O SDK suporta dois ambientes. Por padrão, o ambiente é `homologacao`.

AmbienteDescriçãoBase URL`homologacao`Testes e desenvolvimento`https://apiendpointhml.ailos.coop.br``producao`Ambiente real`https://apiendpoint.ailos.coop.br`Para alternar entre eles, basta passar o ambiente desejado na instanciação do SDK:

```
// Homologação (padrão)
$sdk = new \Ailos\Sdk\AilosSdk(
    clientCredentials:    $clientCredentials,
    cooperadoCredentials: $cooperadoCredentials,
    environment:          'homologacao',
);

// Produção
$sdk = new \Ailos\Sdk\AilosSdk(
    clientCredentials:    $clientCredentials,
    cooperadoCredentials: $cooperadoCredentials,
    environment:          'producao',
);
```

---

Autenticação
------------

[](#autenticação)

O processo de autenticação da API Ailos é composto por três etapas realizadas automaticamente pelo SDK:

1. **Geração do Access Token** — usando suas credenciais de aplicação (Consumer Key e Consumer Secret)
2. **Obtenção do ID** — usando o Access Token junto com os dados da sua aplicação
3. **Autenticação do Cooperado** — usando o Access Token e o ID para autenticar o cooperado, cujo resultado (JWT) é enviado para a URL de callback configurada

O SDK gerencia todo esse fluxo internamente, incluindo a renovação automática dos tokens antes de expirarem.

### Credenciais necessárias

[](#credenciais-necessárias)

Para utilizar o SDK você precisará de:

CredencialDescrição`consumerKey`Chave de identificação da sua aplicação`consumerSecret`Segredo da sua aplicação`urlCallback`URL do seu endpoint que receberá o JWT`ailosApiKeyDeveloper`UUID do desenvolvedor fornecido pela Ailos`codigoCooperativa`Código da cooperativa do cooperado`codigoConta`Código da conta do cooperado`senha`Senha de acesso do cooperado### Instanciando o SDK

[](#instanciando-o-sdk)

```
