Symfony bundle integration of the skrepr/teams-connector library.
All the how to manipulate the Teams client is on the skrepr/teams documentation.
This version of the project requires:
- PHP 7.4+
- Symfony 4.4/5.4/6.0+ (any stable or lts version of Symfony)
You can install the library through composer:
$ composer require skrepr/teams-connector-bundle
The bundle should be enabled by syfmony/flex but if not:
// config/bundles.php
<?php
return [
Skrepr\TeamsConnectorBundle\SkreprTeamsConnectorBundle::class => ['dev' => true, 'test' => true],
];
You can get an error message because the configuration isn't done yet.
To configure the bundle you only need to specify your Teams endpoint:
skrepr_teams_connector:
endpoint: 'https://...'
It is the easiest to create this in a new file config/packages/teams-connector.yaml
.
The Teams client instance can be retrieved from the skrepr_teams_connector.client
service.
Here is an example:
declare(strict_types=1);
namespace App\Controller;
use Psr\Http\Client\ClientExceptionInterface;
use Skrepr\TeamsConnector\Card;
use Skrepr\TeamsConnector\Client;
use Symfony\Component\HttpFoundation\Response;
class TestController
{
private Client $client;
public function __construct(Client $client)
{
$this->client = $client;
}
public function index(): Response
{
$card = new Card('Hello teams!');
try {
$this->client->send($card);
} catch (ClientExceptionInterface $e) {
return new Response($e->getMessage());
}
return new Response('Card has been send');
}
}
All the how to manipulate the Teams connector client is on skrepr/teams-connector.
To test this module you can use our docker test script which will execute phpunit on several PHP versions. You must have docker installed to run this script.
./phpunit-in-docker.sh