1. Go to this page and download the library: Download metarush/log-once 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/ */
metarush / log-once example snippets
use MetaRush\LogOnce\LogOnce;
$message = 'This is my log';
$hash = \crc32($message); // you can use any hash function of your choice e.g., \md5(), \sha1(), etc
(new LogOnce($adapter)) // see adapter examples below
->setTimeZone('UTC')
->setHash($hash)
->setLogMessage($message)
->setNotifiers($notifiers) // optional, see below
->log();
use MetaRush\LogOnce\FileSystem\Adapter as FileSytemLogger;
$logDir = '/path/to/logs';
$adapter = new FileSytemLogger($logDir);
use MetaRush\DataMapper\Builder as DataMapperBuilder;
use MetaRush\LogOnce\Pdo\Adapter as PdoLogger;
$dataMapper = (new DataMapperBuilder)
->setDsn('mysql:host=localhost;dbname=yourLogDb')
->setDbUser('user')
->setDbPass('pass');
->build();
$adapter = new PdoLogger($dataMapper, 'yourLogTable');
use MetaRush\Notifier\Pushover\Builder as PushoverNotifier;
// define a Pushover notifier
$pushoverNotifier = (new PushoverNotifier)
->addAccount('pushover_app_key', 'pushover_user_key')
->setSubject('test subject')
->setBody('test body')
->build();
// $emailNotifier = (new EmailNotifier)...; // optionally add other notifiers
$notifiers = [$pushoverNotifier, $emailNotifier];
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.