skrepr / teams-connector-bundle
Symfony bundle integration of skrepr/teams-connector library
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 9
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^7.4 || ^8.0
- skrepr/teams-connector: ^0.3
- symfony/framework-bundle: ^4.4 || ^5.4 || ^6.0
Requires (Dev)
- guzzlehttp/guzzle: ^7.4
- matthiasnoback/symfony-dependency-injection-test: ^4.0
- phpunit/phpunit: ^9.5
- roave/security-advisories: dev-latest
This package is auto-updated.
Last update: 2024-11-09 12:52:41 UTC
README
Skrepr Teams Connector Bundle
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