laravel-teams-notification / laravel-teams-notification
A Laravel package that integrates Microsoft Teams notification.
v1.0.2
2023-04-09 05:50 UTC
Requires
- php: ^8.1
- guzzlehttp/guzzle: ^7.5
- illuminate/contracts: ^10.0
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.9
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^8.0
- pestphp/pest: ^2.0
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
README
Installation
You can install the package via composer:
composer require laravel-teams-notification/laravel-teams-notification
You can publish the config file with:
php artisan vendor:publish --tag="laravel-teams-notification-config"
This is the contents of the published config file:
return [ /* |-------------------------------------------------------------------------- | Webhook URL |-------------------------------------------------------------------------- | | The webhook URL where we post a request | You can generate test webhook URL in https://typedwebhook.tools/ | or through MS Teams Incoming WebHook | */ 'webhook_url' => env('WEBHOOK_URL', 'your_webhook_url'), ];
Then, you can add WEBHOOK_URL
in your .env
file. More information about how to setup webhook in MS teams in
this link.
Usage
TeamsNotification::create() ->webHookUrl('your_webhook_url') ->payload([ 'type' => 'MessageCard', 'context' => 'https://schema.org/extensions', 'themeColor' => '0076D7', 'summary' => 'Hello, World', 'sections' => [ [ 'activityTitle' => 'Hello, World!', ] ] ]) ->dispatch();
Screenshot
More samples and screenshot of how the message should look can be found in screenshots
folder.
Testing
composer test
Credits
License
The MIT License (MIT). Please see License File for more information.