devorto / microsoft-teams-logger
Logs errors/notices etc to Microsoft Teams using Psr/LoggerInterface.
Installs: 1 314
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- ext-curl: *
- ext-json: *
- psr/log: ^1.1.0
This package is auto-updated.
Last update: 2024-04-19 15:37:47 UTC
README
Send errors/notices/warnings etc to Microsoft Teams, using this Class which implements the Prs/Log/LoggerInterface.
For more information about the logger interface or log levels see their github.
Setup webhook
Before you can use this you need to setup a webhook in a Microsoft Teams channel.
- Goto https://teams.microsoft.com/ and select a team.
- Right mouse click on the desired channel and click "Connectors".
- Search for "Incoming Webhook" and click "configure".
- Provide a name and image.
- Click on "Create".
- A new field will now appear with the new webhook url in it which you can copy-paste.
Example
<?php $slack = new \Devorto\Logger\MicrosoftTeams( '<paste-webhook-url-here>', 'My Test App', 'https://test.example.com' // Optional app url. ); // Use one of the available log level methods: $slack->critical('Help something went critical.'); // You can also drop an Exception in here. $slack->critical(new Exception('Test'));