1. Go to this page and download the library: Download programster/email-logger 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/ */
programster / email-logger example snippets
# Create an emailer, in this case using PHPMailer.
# Any emailer that implements the EmailerInterface will work
$emailer = new Programster\Emailers\PhpMailerEmailer(
"smtp.gmail.com",
"[email protected]",
"app-specific-password-goes-here",
SecurityProtocol::TLS,
"[email protected]",
"Senders Name",
587,
"[email protected]",
"noreply"
);
# Create the email logger
$logger = new EmailLogger(
$emailer,
"my-service-name-here",
new EmailSubscriber("Jenn", "[email protected]"),
new EmailSubscriber("Roy", "[email protected]"),
);
# Create some useful context for the log that might help debugging/resolving what went wrong...
$context = [
'some' => 'details'
];
# Send the log (email)
$logger->critical("There was a critical error!", $context);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.