thatside / moneybird-bundle
用于处理 Moneybird v2 的 Symfony2 扩展包
dev-master
2018-03-16 10:06 UTC
Requires
- php: >=7.0
- beberlei/assert: ^2.7
- picqer/moneybird-php-client: dev-master
- symfony/framework-bundle: >=2.8
Requires (Dev)
- escapestudios/symfony2-coding-standard: ^3.0
- phpmd/phpmd: ^2.6
- phpstan/phpstan: ^0.8.5
- phpunit/phpunit: ~5.0
- squizlabs/php_codesniffer: ^3.0
- symfony/var-dumper: ^3.2
This package is not auto-updated.
Last update: 2024-09-29 04:25:55 UTC
README
MoneyBird Bundle for Symfony 2 Applications. 扩展包提供了对 moneybird-php-client 的包装
基于 KamiLabs 的作品
待定!!!
安装
1. 下载
推荐使用 composer 安装此扩展包
使用 composer 下载扩展包
$ php composer.phar require "thatside/that-moneybird-bundle"
2. 在内核中启用扩展包
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Thatside\MoneybirdBundle\ThatMoneybirdBundle(),
);
}
3. 配置扩展包
将以下配置添加到您的 config.yml 文件中。
# app/config/config.yml
that_moneybird:
redirect_url: localhost
client_id: test_client_id
client_secret: test_client_secret
debug: false # optional parameter for test mode activation
使用扩展包只需要前三个配置值。重定向 URL 必须是非 localhost,因此请使用任何隧道服务进行测试。(推荐使用 https://github.com/beameio/beame-insta-ssl)。
令牌存储
您需要首先设置一些事情,以便在某个地方存储授权码和访问令牌。
- 重新定义
that_moneybird.code_fetcher
服务以使用您的自定义类(使用CodeFetcherInterface
进行此操作)。 - 添加一个监听
moneybird.token_update
事件的订阅者(请参阅MoneybirdTokenEvent
)。 - 在 Moneybird 授权后手动保存授权码
MoneyBird 服务
此扩展包的核心组件是 MoneyBird 服务。它提供了围绕 Picqer Moneybird 类的简单包装 - 通过 getMoneybird()
调用可用。
仍在考虑在这里使用 __call
...
<?php
$this->get('that_moneybird');