viebig / cobregratis
PHP包装Cobre Grátis API,支持Composer
dev-master
2014-10-31 15:34 UTC
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2024-09-24 02:37:13 UTC
README
该库是一组PHP类,用于通过Cobre Grátis API访问信息。API。
所有类都继承自PHP ActiveResouce。有关更多信息,请参阅PHP ActiveResouce文档。
安装
通过composer
composer require "viebig/cobregratis": "dev-master"
通过git
git clone https://github.com/CobreGratis/cobregratis-php.git
配置您的token
require 'lib/CobreGratis.php'; $bank_billet = new BankBillet(); $bank_billet->user = "seu_token"; $bank_billet->password = "X";
使用方法
# criar um boleto $bank_billet = new BankBillet(array( 'amount' => 230.50, 'expire_at' => '2015-07-22', 'name' => 'Rafael Lima' )); $bank_billet->user = "seu_token"; $bank_billet->password = "X"; $bank_billet->save(); # listar todos os boletos $bank_billet->extra_params = "?page=1"; $bank_billets = $bank_billet->find('all'); if($bank_billets->errno) { print "$bank_billets->error\n"; } else { foreach($bank_billets as $bank_billet) { print "Nosso Número: $bank_billet->our_number\n"; print "Vencimento: $bank_billet->expire_at\n"; print "Valor: $bank_billet->amount\n"; print "Sacado: $bank_billet->name\n"; print "URL: $bank_billet->external_link\n"; print "=================================\n"; } }
请查看示例: bank_billet.php customer.php bank_billet_subscription.php
许可证
此代码可在MIT许可证的条款内免费使用。
错误、问题、感谢等
欢迎评论。请通过GitHub问题跟踪器发送您的反馈。
作者
Rafael Lima 在 CobreGratis 工作
Twitter: http://twitter.com/rafaelp