skrepr/teams-connector-bundle

Symfony bundle integration of skrepr/teams-connector library

v1.1.0 2023-01-09 09:12 UTC

This package is auto-updated.

Last update: 2024-04-09 11:39:36 UTC


README

skrepr_logo

Skrepr Teams Connector Bundle

Releases LICENSE Issues Stars

Symfony bundle integration of the skrepr/teams-connector library.

Documentation

All the how to manipulate the Teams client is on the skrepr/teams documentation.

Prerequisites

This version of the project requires:

  • PHP 7.4+
  • Symfony 4.4/5.4/6.0+ (any stable or lts version of Symfony)

Installation

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.

Configuration

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.

Usage

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.

Test

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