thatside / moneybird-bundle

用于处理 Moneybird v2 的 Symfony2 扩展包

安装: 324

依赖: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 0

开放问题: 0

类型:symfony-bundle

dev-master 2018-03-16 10:06 UTC

This package is not auto-updated.

Last update: 2024-09-29 04:25:55 UTC


README

Build Status

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)。

令牌存储

您需要首先设置一些事情,以便在某个地方存储授权码和访问令牌。

  1. 重新定义 that_moneybird.code_fetcher 服务以使用您的自定义类(使用 CodeFetcherInterface 进行此操作)。
  2. 添加一个监听 moneybird.token_update 事件的订阅者(请参阅 MoneybirdTokenEvent)。
  3. 在 Moneybird 授权后手动保存授权码

MoneyBird 服务

此扩展包的核心组件是 MoneyBird 服务。它提供了围绕 Picqer Moneybird 类的简单包装 - 通过 getMoneybird() 调用可用。

仍在考虑在这里使用 __call...

<?php
    $this->get('that_moneybird');