ejtj3 / teams-bundle
EJTJ3/teams库的Symfony组件集成
0.1.2
2021-07-23 12:17 UTC
Requires
- php: ^7.2.5 | ^8.0
- ejtj3/teams: 0.1.3
Requires (Dev)
- matthiasnoback/symfony-dependency-injection-test: ^4.0
- phpunit/phpunit: ^8.0
- symfony/framework-bundle: ^3.4 || ^4.4 || ^5.0
This package is auto-updated.
Last update: 2024-09-23 19:16:44 UTC
README
Symfony组件集成ejtj3/teams库。
文档
如何操作Teams客户端的所有内容在EJTJ3/teams文档中。
先决条件
此项目版本需要
- PHP 7.2+
- Symfony 3.4+
安装
首先,您需要通过composer要求此库
$ composer require ejtj3/teams-bundle
然后,在AppKernel
类中启用此组件
// config/bundles.php <?php return [ EJTJ3\TeamsBundle\EJTJ3TeamsBundle::class => ['dev' => true, 'test' => true], ];
配置
根据您的需求配置组件
ejtj3_teams: endpoint: 'https://...'
使用
可以从ejtj3_teams.client
服务检索Teams客户端实例。
以下是一个示例
<?php declare(strict_types=1); namespace App\Controller; use EJTJ3\Teams\Card; use EJTJ3\Teams\Client; use EJTJ3\Teams\Exception\InvalidPayloadWebHookException; use Symfony\Component\HttpFoundation\Response; class TestController { /** * @var Client */ private $client; public function __construct(Client $client) { $this->client = $client; } public function index(): Response { $card = new Card('Hello teams!'); try { $this->client->send($card); } catch (InvalidPayloadWebHookException $e) { return new Response($e->getMessage()); } return new Response('Card has been send'); } }
如何操作Teams客户端的所有内容在EJTJ3/teams文档中。