phpvv/notice

VV Notice Service

0.1.1 2021-03-20 13:57 UTC

This package is auto-updated.

Last update: 2024-10-20 21:45:19 UTC


README

VV Notice Service

(todo: complete)

Installation

Package is available on Packagist, you can install it using Composer.

composer require phpvv/notice

Configuring

// bootstrap.php
require_once __DIR__ . '/vendor/autoload.php';

use VV\Notice;

\VV\Notice::factory()->config()
    ->addAllNoticer(new class implements \VV\Notice\AllNoticer {
        public function log(\VV\Notice $notice){
         // TODO: Implement log() method.
        }
        public function sendMail(\VV\Notice $notice,string $subject,string $message) : void{
         // TODO: Implement sendMail() method.
        }
        public function sendSms(\VV\Notice $notice) : void{
         // TODO: Implement sendSms() method.
        }
        public function syslog(\VV\Notice $notice) : void{
         // TODO: Implement syslog() method.
        }
    })
    //->setSmsRepeatTimeout(3600)
    //->setCache(new \VV\Cache\Local\FileCache(\VV\Utils\Fs::tmpDir('notice-timeout-lock')))
    ;

Usage

use VV\Notice;

Notice::info('Some information'/*, code: 300*/)->mail();
Notice::warning('Some warning'/*, code: 200*/)
    //->log()->mail()  // same as below
    ->logMail();
Notice::error('Some error'/*, code: 100*/)
    //->log()->mail()->syslog()->sms() // same as below
    ->all();