PHP code example of mpakfm / printu
1. Go to this page and download the library: Download mpakfm/printu 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/ */
mpakfm / printu example snippets
Printu::setConfNotifier([
'warning' => 'email',
'alert' => 'email',
]);
Printu::setConfChannel([
'email' => ['[email protected] ', '[email protected] ']
]);
Printu::$fromNotifier = 'no-reply@server';
Printu::$subjNotifier = 'Some project';
$var = ['asd', 'fgh'];
Printu::debug($var);
Printu::info($var)->title('INFO $var');
Printu::warning($var)->title('WARNING $var');
Printu::alert($var)->title('ALERT $var');
public static function setDefaultResponse(string $response): bool {}
public static function setPath(string $path=''): bool {}
Printu::setPath(__DIR__.'/var/log');
Printu::setDefaultResponse('html');
Printu::obj($_POST)->title('POST');
Printu::setPath(__DIR__ . '/var/log');
Printu::obj('-----')->response('file')->show();
$dt = new \DateTime();
$dt->sub(new \DateInterval('P1MT10H'));
Printu::obj('test')->title('IndexController::index')->dt($dt)->response('file')->show();
Printu::obj('test H:i:s in log file info.log')->dt()->timeFormat('H:i:s')->response('file')->show();
Printu::obj('test in log file error.log')->response('file')->file('error')->show();
Printu::obj('test echo')->show();
Printu::setPath(__DIR__ . '/var/log');
$dt = new \DateTime();
$dt->sub(new \DateInterval('P1MT10H'));
Printu::log('-------', '', 'file');
Printu::log('test', $dt->format('d.m H:i:s')."\t".'IndexController::index', 'file');
Printu::log('test in log file info.log', 'IndexController::index', 'file');
Printu::log('test in log file error.log', 'IndexController::index', 'file', 'error.log');