Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/efureev/loogger-driver-php
Loogger driver php
https://github.com/efureev/loogger-driver-php
Last synced: about 7 hours ago
JSON representation
Loogger driver php
- Host: GitHub
- URL: https://github.com/efureev/loogger-driver-php
- Owner: efureev
- License: mit
- Created: 2022-06-17T06:28:51.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-06-17T08:39:35.000Z (over 2 years ago)
- Last Synced: 2024-05-14T07:22:07.932Z (6 months ago)
- Language: PHP
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Loogger Notification Driver
## Description
PHP driver for `Loogger` service to send notifications to `Telegram`.
## Install
```bash
composer require efureev/loogger "^1.0"
```## Use
### In your code:
```php
$looggerConfig = new Config($looggerConfigJson);
$loogger = new Loogger($looggerConfig);$loogger->send($msg);
// ...
$loogger
->pattern("Gitlab: {{MSG}}")
->sendHTML("Hello from service");
```A Message type format:
```php
$loogger
->asPlain() // send message as plain
// ->send('Text')
->asHTML() // send message as HTML
// ->send('Boldcode')
->asMD() // send message as Markdown.
// ->send('*Bold* text')
```Allowed variables for patterns and message:
- `MSG` - The Message content
- `SERVICE_NAME` - The service name
- `SERVICE_DESCRIPTION` - The service description
- `NOW` - The datetime. Format: `RFC822`
- `CHAT_ID` - The TG-chat ID
- `BR` - Return a cursor to the next line. Like a `\n`.
- `TAB` - Return a cursor to the next line. Like a `\t`.### from console-file:
```shell
php send2loogger.php --msg='Testing message!'
```**Arguments:**
* `--cnf=` - A full path to config file. Config file should be a JSON typed.
* `--msg=''` - A sending message
* `--debug` - Enables `debug mode`### from curl:
```shell
curl --location --request POST 'https://loogger.mockery.dev/push' \
--header 'X-Token: $2a$10$du8TEzvOs6HTgrbkuuTl0JNnhGF2Ki3xLKuPG5LoGBcn4S91W' \
--data-raw 'Hello from service'
```## Use Loogger service
Loogger is a service to send various notifications.
Nowdays, it has only one driver: `Telegram`.The service located at `https://loogger.mockery.dev`.
To use the Loogger service you should register there through Telegram:
- Add tg-bot `@Loogger` to your group or direct chat to it.
- To register into Loogger:
_For person chat_: you should send auth data to it.
_For group chat_: nothing.
- Create a service: `/add`A full list of commands you receive on `/help`