sverraest/revolut-php-bundle

Revolut Business API 的 Symfony PHP Bundle

v1.0.1 2018-04-08 13:59 UTC

This package is auto-updated.

Last update: 2024-09-13 01:53:13 UTC


README

RevolutPHP 的 Symfony Bundle - https://github.com/sverraest/revolut-php

Build Status codecov Scrutinizer Code Quality Maintainability

安装

此 Bundle 适用于 Symfony3 及更高版本。

步骤 1: 下载 Bundle

打开命令行,进入您的项目目录,然后执行以下命令以下载此 Bundle 的最新稳定版本

$ composer require sverraest/revolut-php-bundle

此命令要求您已全局安装 Composer,具体请参阅 Composer 文档中的安装章节

步骤 2: 启用 Bundle

然后,将 Bundle 添加到项目 app/AppKernel.php 文件中已注册的 Bundle 列表,以启用 Bundle

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Sverraest\RevolutPHPBundle\SverraestRevolutPHPBundle(),
        );

        // ...
    }

    // ...
}

步骤 3: 添加配置

您必须指定以下配置

sverraest_revolut_php:
    api_key: 'foo'
    mode: 'production' # options are production or sandbox

步骤 4: 获取 RevolutPHP 服务

您可以通过获取公共 RevolutPHP 服务实例或自动注入来实现。

// src/AppBundle/Controller/AcmeController.php
...

$revolut = $this->get('revolut_php.client');
print_r($revolut->accounts->all())

...

或者通过自动注入

// src/AppBundle/Service/AcmeService.php
...

public function __construct(RevolutPHP\Client $client) 
{
    $this->client = $client;
}

...

文档

阅读此 Bundle 的文档

www.appfleet.uk