wmds / mindbodyonline-api-bundle

将 MindBodyOnline.com API 集成到 Symfony 2 中

安装量: 6,191

依赖关系: 0

建议者: 0

安全: 0

星标: 4

关注者: 2

分支: 2

开放问题: 2

类型:symfony-bundle

dev-master 2013-10-25 06:49 UTC

This package is not auto-updated.

Last update: 2024-09-14 15:47:36 UTC


README

将 MindBodyOnline.com API 集成到 Symfony 2 中

1. 安装包

php composer.phar require wmds/mindbodyonline-api-bundle dev-master

将包添加到您的 AppKernel.php 文件中

// app/AppKernel.php
public function registerBundles()
{
    return array(
        // ...
        new Wmds\MindBodyAPIBundle\WmdsMindBodyAPIBundle(),
        // ...
    );
}

将配置数据添加到您的 app/config/config.yml 文件

# app/config/config.yml
wmds_mind_body_api:
    api_user: YourSourceName                    # (Required)
    api_key:  YourPassword                      # (Required)
    site_ids:  [ 100 ]                          # (Required) if not set, default to -99 (sandbox)
    sandbox:  true                              # (Optional) default: true
    debug:    false                             # (Optional) default: false
    xml: 'Full'                                 # (Optional) default: Full, possible: Bare, Basic, Full

2. 使用方法

此包是一个服务,要使用它

// Anywhere in your controller
$mbapi = $this->get('wmds_mind_body_api');

MindBodyOnline.com 提供了一系列可用的服务,您可以在 http://api.mindbodyonline.com/Doc 上查看

// Get the SaleService
$sale = $mbapi->getService('sale');

//Get the AppointmentService
$appointment = $mbapi->getService('AppoinTment'); // string passed is case insensitive

使用 API 服务时,这将自动设置 $sale 对象,初始化 SOAP 对象,并传递 wsdl url。

要发送请求,调用 setParam() 函数添加所有需要的参数,然后执行()

$products =  $sale->setAction('GetProducts')
                ->setParam('SellOnline',true)
                ->execute();