A collection of webclients to send messages to Slack, Facebook, Twitter, Telegram, ...
composer config repositories.turbolabit/php-symfony-messenger git https://github.com/TurboLabIt/php-symfony-messenger.git
composer require turbolabit/php-symfony-messenger:dev-main
Get your Slack webhook endpoint from https://api.slack.com/apps
APP_SLACK_ENABLED=true
## Channel: #my-channel-name https://my-company.slack.com/archives/AAABBCCC
APP_SLACK_ENDPOINT=https://hooks.slack.com/services/AABBCC/AABBCC/AABBCC
## Channel: #my-channel-name https://my-company.slack.com/archives/AAABBCCC
APP_SLACK_ENDPOINT_ERRORS=https://hooks.slack.com/services/AABBCC/AABBCC/AABBCC
TurboLabIt\Messengers\SlackMessenger:
arguments:
$arrConfig:
Slack:
enabled: '%env(bool:APP_SLACK_ENABLED)%'
endpoints:
main: '%env(APP_SLACK_ENDPOINT)%'
errors: '%env(APP_SLACK_ENDPOINT_ERRORS)%'
<?php declare(strict_types=1);
namespace App\Command;
use TurboLabIt\Messengers\SlackMessenger;
class MyService
{
public function __construct(protected SlackMessenger $slackMessenger)
{ }
public function someFx()
{
// ...
$this->slackMessenger->sendMessageToChannel($text);
$this->slackMessenger->sendErrorMessage($text);
// ...
}
}
git clone git@github.com:TurboLabIt/php-doctrine-runtime-manager.git
cd php-doctrine-runtime-manager
clear && bash script/test_runner.sh