banckle / chat-bundle
这是一个用于在 symfony2 应用程序中快速、轻松地使用 Banckle.Chat SDK 的 symfony2 扩展包。
dev-master
2014-10-14 15:51 UTC
Requires (Dev)
- symfony/framework-bundle: >=2.0
This package is not auto-updated.
Last update: 2024-09-24 08:12:12 UTC
README
#Banckle.Chat for Symfony
此扩展包允许您在 Symfony 应用程序中快速、轻松地使用 Banckle.Chat SDK。
安装
将以下行添加到您的 composer.json 文件中
// composer.json
{
// ...
require: {
// ..
"banckle/chat-sdk-php": "dev-master",
"banckle/chat-bundle": "dev-master"
}
}
现在,您可以从 composer.json 文件所在的目录运行 Composer 的 update 命令来安装新的依赖项。
composer update
更新您的 AppKernel.php 文件,并注册新的扩展包
// app/AppKernel.php
public function registerBundles()
{
// ...
new Banckle\ChatBundle\BanckleChatBundle(),
// ...
);
}
配置
将此添加到您的 config.yml
banckle_chat:
#(Required) Your Account apiKey from apps.banckle.com
apiKey: "XXXXXXXXXXXXX"
banckleAccountUri: "https://apps.banckle.com/api/v2"
banckleChatUri: "https://chat.banckle.com/v3"
使用方法
此扩展包可以作为标准服务调用。
To access service:
$bancklechat = $this->get('bancklechat.api');
To generate token:
$bancklechat = $this->get('bancklechat.api');
$token = $bancklechat->getToken($email, $password);
To access all departments:
$department = $bancklechat->createInstance('DepartmentsApi', $token);
$result = $department->getDepartments();