PHPackages                             kopitar/laravel-teams-logger - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. kopitar/laravel-teams-logger

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

kopitar/laravel-teams-logger
============================

Laravel package for sending configurable messages to Microsoft Teams via the incoming webhook url

1.0.2(2y ago)31.3k↓50%1[2 PRs](https://github.com/kopitar/laravel-teams-logger/pulls)MITPHPPHP ^8.1CI passing

Since Aug 6Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/kopitar/laravel-teams-logger)[ Packagist](https://packagist.org/packages/kopitar/laravel-teams-logger)[ RSS](/packages/kopitar-laravel-teams-logger/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (6)Used By (0)

Laravel Teams Logger
====================

[](#laravel-teams-logger)

[![Latest Version on Packagist](https://camo.githubusercontent.com/f0f1d9f0aa458e730073d97ef6771f634938bc7c6b4e3fd7da50f4136cc753e9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b6f70697461722f6c61726176656c2d7465616d732d6c6f676765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kopitar/laravel-teams-logger)[![GitHub Tests Action Status](https://camo.githubusercontent.com/b3a14fd9e96146e8f7d24c9addac53599c82ab04f1e69e9ee6f81958466b4a7e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6b6f70697461722f6c61726176656c2d7465616d732d6c6f676765722f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/kopitar/laravel-teams-logger/actions?query=workflow%3Arun-tests+branch%3Amain)[![Total downloads](https://camo.githubusercontent.com/0e66f6d3dc63d6d584318ac266d531bf255b9c3f881c0986f81422fcca52c28a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b6f70697461722f6c61726176656c2d7465616d732d6c6f676765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kopitar/laravel-teams-logger)

Log handler for Laravel for sending log messages to Microsoft Teams with the [Teams Incoming Webhook Connector](https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook).

**Tested on:**

- Laravel 10.x (PHP 8.3, 8.2, 8.1)
- Laravel 11.x (PHP 8.3, 8.2)

Features
========

[](#features)

- send simple styled log messages
- send card styled \**log* messages
- include facts in card log messages
- include actions in card log messages
- configurable content and visuals (colors, avatars)

Installation
============

[](#installation)

Require this package with composer.

```
$ composer require kopitar/laravel-teams-logger
```

Configuration
=============

[](#configuration)

After installing the package using composer, create a new [custom channel](https://laravel.com/docs/master/logging#creating-custom-channels-via-factories) in `config/logging.php`:

```
'teams' => [
    'driver'  => 'custom',
    'via'     => \Kopitar\LaravelTeamsLogger\TeamsLoggerFactory::class,
    'level'   => 'debug',
    'url'     => env('TEAMS_WEBHOOK_URL')
],
```

Copy `teams_logger.php` config file from this package to your Laravel config folder with the following command:

```
$ php artisan vendor:publish --tag=teams
```

Add `TEAMS_WEBHOOK_URL` variable to your `.env` file with the URL provided by your Microsoft Teams Connector. (See [MS Teams Documentation](https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook?tabs=dotnet#create-incoming-webhooks-1) for more information on where to get your webhook URL).

There are additional `.env` variables for this package that are optional and have default values. The names of these variables can be found in [`config/teams_logger.php`](src/config/teams_logger.php) and on the list bellow. These optional `.env` variables provide a way for you to change number of retries, disable avatars, set a default message type etc.

- TEAMS\_LOG\_NAME (*name of logger, also used as title in card type messages*)
- TEAMS\_LOG\_TYPE (*sets one of three types of log messages*)
- TEAMS\_RETRIES (*number of retries if request to Teams webhook fails*)
- TEAMS\_MARKDOWN (*disable or enable markdown in card type messages*)
- TEAMS\_AVATAR (*disable or enable avatar image in messages*)

To change colors or avatar images you need to replace the values found for each log level in `config/teams_logger.php`.

Usage
=====

[](#usage)

**Simple type:**

To send a simple style log message to Teams use the following code (assuming `type` is configured to `simple`):

```
Log::channel('teams')->info('Neque porro quisquam est qui dolorem!');
```

**Result:**

[![Screenshot](./images/simple_info.png)](./images/simple_info.png)

**Card type:**

To send a card style log message to Teams use the following code (assuming `type` is configured to `card` and `use_avatar` is set to `true`):

```
Log::channel('teams')->debug('Neque porro quisquam est qui dolorem!');
```

**Result:**

[![Screenshot](./images/card_debug_avatar.png)](./images/card_debug_avatar.png)

**Json type:**

To send any style log messages to Teams you can also simply use JSON formatted data (assuming `type` is configured to `json`):

```
Log::channel('teams')->info('{"text":"Neque porro quisquam est qui dolorem!","themeColor":"#df0087"}');
```

This example would produce a simple log message with a `themeColor` of *\#df0087*

**Result:**

[![Screenshot](./images/json_type.png)](./images/json_type.png)

Advanced Usage
==============

[](#advanced-usage)

1. Override configuration
-------------------------

[](#1-override-configuration)

Almost any configuration value can be overriden on any log message by defining a new value in the second parameter. The simplest example would be overriding the `type` setting. If your config says to use *simple type* for your log messages but you want to send a *card type* at a specific place in your code you can do this like in the example below:

```
Log::channel('teams')->info(
    'Neque porro quisquam est qui dolorem!', ['type' => 'card']
);
```

Other possible configuration overrides are listed in the example below:

```
Log::channel('teams')->debug(
    'Neque porro **quisquam** est qui dolorem! [Markdown disabled](http://example.net)',
    [
        'type' => 'card',
        'title' => 'Alternative title',
        'themeColor' => '#0000ff',
        'avatar' => false,
        'markdown' => false
    ]
);
```

This sets `type` to '*card*', `activityTitle` to '*Alternative title*', sets the `themeColor` to *blue* and disables *avatar image* and *markdown*.

**Result:**

[![Screenshot](./images/override_config.png)](./images/override_config.png)

If sending messages of *simple type* the only config value you are able to override is `themeColor`. Markdown is used by default and cannot be disabled!

```
Log::channel('teams')->debug('Neque porro **quisquam** est qui dolorem!', ['themeColor' => '#0000ff']);
```

2. Facts
--------

[](#2-facts)

When using '*card*' type you can also pass a `facts` parameter which needs to be an array. The contents of this array are then rendered as a *key:value* list in the card message.

```
Log::channel('teams')->critical(
    'Neque porro quisquam est qui dolorem!',
    [
        'type' => 'card',
        'facts' => [
            'happened at' => now()->toDayDateTimeString(),
            'file' => __FILE__,
            'severity' => 'Critical'
        ],
    ]
);
```

**Result:**

[![Screenshot](./images/facts.png)](./images/facts.png)

3. Actions
----------

[](#3-actions)

When using '*card*' type you can also pass an `actions` parameter which needs to be an array. Actions provide a way for you to include a `potentialAction` property in your message which is an array of actions which add interactive actions in your messages like *adding comments, changing statuses, opening links* etc.

Read [Actions](https://learn.microsoft.com/en-us/outlook/actionable-messages/message-card-reference#actions) documentation on [learn.microsoft.com](https://learn.microsoft.com/en-us) for more information!

```
        Log::channel('teams')->info("Neque porro quisquam est qui dolorem!", [
           'type' => 'card',
           'actions' => [[
                '@type' => 'ActionCard',
                'name' => 'Add a comment',
                'inputs' => [
                    [
                        '@type' => 'TextInput',
                        'id' => 'comment',
                        'isMultiline' => false,
                        'title' => 'Add a comment here for this task'
                    ]
                ],
                'actions' => [
                    [
                        '@type' => 'HttpPOST',
                        'name' => 'Add comment',
                        'target' => 'https =>//learn.microsoft.com/outlook/actionable-messages'
                    ]
                ],
            ]]
        ]);
```

**Result:**

[![Screenshot](./images/actions.png)](./images/actions.png)

Preview (simple type)
=====================

[](#preview-simple-type)

[![Screenshot](./images/simple_all.png)](./images/simple_all.png)

Preview (card type)
===================

[](#preview-card-type)

[![Screenshot](./images/cards_all.png)](./images/cards_all.png)

Changelog
=========

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

License
=======

[](#license)

This laravel-teams-logging package is available under the MIT license. See [LICENSE.md](LICENSE.md) file for more info.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance48

Moderate activity, may be stable

Popularity21

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 70% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~112 days

Total

3

Last Release

786d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bc2665d5b42465a09ac3a143bfc6116b34b1528a6a89bc0948221f45a50d4afb?d=identicon)[kopit](/maintainers/kopit)

---

Top Contributors

[![kopitar](https://avatars.githubusercontent.com/u/19343414?v=4)](https://github.com/kopitar "kopitar (7 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")

---

Tags

laravelhandlermonologTeams

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kopitar-laravel-teams-logger/health.svg)

```
[![Health](https://phpackages.com/badges/kopitar-laravel-teams-logger/health.svg)](https://phpackages.com/packages/kopitar-laravel-teams-logger)
```

###  Alternatives

[osa-eg/laravel-teams-notification

A Laravel package to send notifications to Microsoft Teams

71257.5k1](/packages/osa-eg-laravel-teams-notification)[naoray/laravel-github-monolog

Log driver to store logs as github issues

10619.4k](/packages/naoray-laravel-github-monolog)[shaffe/laravel-mail-log-channel

A package to support logging via email in Laravel

1286.2k](/packages/shaffe-laravel-mail-log-channel)[yzen.dev/mono-processor

This Processor will display in the logs bread crumbs by which you can more quickly and accurately identify the cause of the error.

116.1k](/packages/yzendev-mono-processor)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
