PHP code example of pyaesone17 / lapse

1. Go to this page and download the library: Download pyaesone17/lapse 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/ */

    

pyaesone17 / lapse example snippets


    // config/services.php
    'telegram-bot-api' => [
        'token' => env('TELEGRAM_BOT_TOKEN', 'YOUR BOT TOKEN HERE')
    ],
 bash
$ php artisan vendor:publish
 bash
$ php artisan vendor:publish
 bash
php artisan migrate
 php
    \Pyaesone17\Lapse\Lapse::auth(function($request) {
        // return true / false . For e.g.
        return \Auth::check();
    });
 bash
$ php artisan clear:lapse
 php
// config/app.php
'providers' => [
    ...
    NotificationChannels\Telegram\TelegramServiceProvider::class,
],
 php
    use NotificationChannels\Telegram\TelegramMessage;
    use Pyaesone17\Lapse\ErrorNotifiable;
    ..
    
    class Handler extends ExceptionHandler
    {
        use ErrorNotifiable;
        ...
    
        public function report(Exception $exception)
        {
            if( app()->environment()!='local' ){ // Remove this line if you want lapse to notify in local environment
                $this->sendNotification($exception, $this->getFormatters());
            }
        }

        protected function getFormatters()
        {
            $formatters = array(
                'toTelegram' => function($notifiable) {
                    return TelegramMessage::create()
                    ->content("*HELLO!* \n One of your invoices has been paid!");
                }
            );

            return $formatters;
        }
        ...  
    }