1. Go to this page and download the library: Download ale10257/error-message-yii2 library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use ale10257\sendError\LogError;
try {
// ...
} catch (\Throwable $e) {
LogError::error('Ошибка при обработке заказа', $e, false);
}
namespace YourNamespace;
use ale10257\sendError\IErrorBot;
class YourMessenger implements IErrorBot
{
private string $apiKey;
private string $chatId;
public function __construct(string $apiKey, string $chatId)
{
$this->apiKey = $apiKey;
$this->chatId = $chatId;
}
public function sendErrorMsg(string $message): void
{
// POST в API your-messenger (или другой сервис)
}
}
bash
php yii queue/listen --verbose=1
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.