cbytedigital / laravel-teams-logger
Laravel package to log exceptions to a Microsoft Teams channel using Microsoft Teams Webhooks.
Installs: 2 769
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 0
Forks: 1
Open Issues: 0
Requires
- php: ^8.0
- laravel/framework: ^8.37|^9.0|^10.0|^11.0
Requires (Dev)
- orchestra/testbench: ^6.12.1
- phpunit/phpunit: ^9.3.3
README
A Laravel package which can be used for log handling through laravel logging using the Microsoft teams webhook.
Installation
Use composer to install this package:
$ composer require cbytedigital/laravel-teams-logger
Usage
After installing the package through composer, we need to edit the logging. We have to add a teams channel with the following information. (The channel name can be whatever you want, just match it with the channel entered in the array of the stack channel)
'channels' => [ 'stack' => [ 'driver' => 'stack', 'channels' => ['single', 'teams' /** This is important for the channel to register properly */], 'ignore_exceptions' => false, ], ... 'teams' => [ 'driver' => 'custom', 'via' => \CbyteDigital\TeamsLogger\Logging\TeamsLoggingChannel::class, 'type' => \CbyteDigital\TeamsLogger\Enums\LogType::EXCEPTION, 'level' => 'error', 'url' => env('TEAMS_WEBHOOK_URL') /** This is the webhook URL generated by Teams */, 'name' => 'Project name', ], ]
How to get a Webhook URL in Microsoft Teams
Create a channel inside Microsoft Teams and open the channel. In the top right corner of the channel, you will see three dots. If you click there, you will have to go to Connectors.
Here you will install the connector 'Incoming Webhook'. Next you can configure this for each project. Enter a name and icon and click on 'create'. This will generate a URL which we need for this package to work.
Testing
Run the tests with:
$ composer test
Support
Postcardware
This package is completely free to use. If it makes it to your production environment we would highly appreciate you sending us a postcard from your hometown! 👏🏼
Our address is: CBYTE Software B.V., Heuvelkamp 2a, 6658DE Beneden-Leeuwen, Netherlands.
License
The MIT License (MIT). Please see License File for more information.