r2soft/r2-sicredi-api
Composer 安装命令:
composer require r2soft/r2-sicredi-api
包简介
A PHP SDK for the Sicredi API
README 文档
README
This package provides a PHP client for interacting with the Sicredi API. It allows developers to easily integrate Sicredi into their PHP applications. The client supports a wide range of features inside the Charges API, including creating and querying boletos, generating boletos slips, and retrieving payment reports.
The package is built on top of the Guzzle HTTP client and provides a simple, object-oriented API for interacting with the Sicredi API. It also includes comprehensive documentation and examples to help developers get started quickly.
While the package currently only supports the API for Boletos, it is designed with extensibility in mind, and can easily be extended to support additional functionality as needed.
Installation
First, you will need to install Composer following the instructions on their site.
Then, simply run the following command:
composer require BrunoPansani/sicredi-api
Usage
Once you have installed it, you can use the following steps to create a new Boleto:
- Create a new Client instance: Create a new Client instance by passing your SICREDI API key, cooperative number, post number, and beneficiary number as arguments. For example:
$client = new \SicrediAPI\Client( $_ENV['SICREDI_API_KEY'], $_ENV['SICREDI_COOPERATIVE'], $_ENV['SICREDI_POST'], $_ENV['SICREDI_BENEFICIARY'], new \GuzzleHttp\Client(), true);
This example uses environment variables, but feel free to use any method you prefer to pass the parameters.
-
Call the authenticate() method on the Client instance to authenticate with the Sicredi API by passing your Sicredi API username and password as arguments.
-
Get the Boleto resource client from the Client instance by calling the boleto() method. For example:
$client->authenticate($_ENV['SICREDI_USERNAME'], $_ENV['SICREDI_PASSWORD']); $boletoClient = $client->boleto();
- Create a new Boleto instance by passing the necessary parameters, such as beneficiary information, payee information, amount, and due date. For example:
$boleto = new \SicrediAPI\Domain\Boleto\Boleto( (new Beneficiary( 'Jose da Silva', '86049253099', 'person' )), (new Payee( 'Maria de Lurdes', '50581718054', 'person' )), 100.00, 'DM', 12345, 'RECIBO', '999999', new DateTime('2023-12-31') );
- Call the create() method on the Boleto resource client to create the Boleto. For example:
$boletoClient->create($boleto);
- Store and/or do anything else you need to do with the Boleto information returned by the create() method.
Validation and Production
Before using the Cobrança API friom Sicredi, please follow the sequential steps for validation and production contained in the attached manual, available at docs/.
In summary, the process for validation includes the following steps:
- Access the Developer Portal
- Create an APP for Sandbox
- Request the Sandbox API Token
- Test the URLs available in the Homologation environment
- Create an APP for Production
- Request the Production API Token
- Test the URLs available in the Production environment
- Deploy your solution
To create the Sandbox APP, the developer must access the Sicredi Developer Portal, create an account or log in, and create a new application with the prefix "API Cobrança Sandbox".
After creating the Sandbox APP, the developer should request the Sandbox API Token through the menu 'Suporte' > 'Abrir Chamado' in the Developer Portal. Select the appropriate option and fill in the name of the APP created previously. The API Token will be generated within a few days and can be found in the 'Minhas Apps' menu, under the details of the respective application.
The URLs available for testing can be found in the API manual.
For the production process, repeat the same steps for creating the APP, but with a different name, such as "API Cobrança Production". After creating the APP, request the API Token for Production, following the same steps as for Sandbox.
Remember that, in all operations, the authentication token received must be informed in the x-api-key header of the request. This token is different for each environment.
If you have any doubts, please contact the support channels listed in the attached manual, or visit the Developer Portal.
Contributing
We welcome contributions to this package! If you would like to contribute, please follow these guidelines:
- Fork the repository and make your changes.
- Submit a pull request with a clear explanation of your changes and why they are necessary.
- Be responsive to feedback and open to making changes to your pull request.
Remember you can always check Sicredi's documentation available at docs/.
Thank you for your interest in contributing to this package!
License
This package is released under the MIT License.
Contact
If you have any questions or issues, please contact me at bruno@pansani.dev.
r2soft/r2-sicredi-api 适用场景与选型建议
r2soft/r2-sicredi-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 210 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 05 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「api」 「sdk」 「sicredi」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 r2soft/r2-sicredi-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 r2soft/r2-sicredi-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 r2soft/r2-sicredi-api 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PSR-7 compatible library for making CRUD API endpoints
Alfabank REST API integration
Zero-dependency raw PHP DNS resolver, domain-ownership verification, and intoDNS/MxToolbox-style diagnostics. Queries authoritative nameservers directly over sockets — never trusts the recursive cache for ownership checks.
A lightweight plain-PHP framework for database-backed CRUD APIs.
bughq error tracking - PHP SDK
ABsurge PHP SDK for feature flags and A/B testing
统计信息
- 总下载量: 210
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-05-28