PHP code example of skrepr / teams-connector-bundle

1. Go to this page and download the library: Download skrepr/teams-connector-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

skrepr / teams-connector-bundle example snippets


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');
    }
}
 php
// config/bundles.php



return [
    Skrepr\TeamsConnectorBundle\SkreprTeamsConnectorBundle::class => ['dev' => true, 'test' => true],
];