PHP code example of gcrico / swift-mailer-psr-logger-plugin
1. Go to this page and download the library: Download gcrico/swift-mailer-psr-logger-plugin 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/ */
gcrico / swift-mailer-psr-logger-plugin example snippets
use gcrico\SwiftMailerPsrLoggerPlugin\SwiftMailerPsrLoggerPlugin;
$transport = /*...*/;
$mailer = Swift_Mailer::newInstance($transport);
$logger = new YourFavoritePsr3Logger();
$mailer_logger = new SwiftMailerPsrLoggerPlugin($logger);
$mailer->registerPlugin($mailer_logger);
$app['swiftmailer.spooltransport'] = $app->share(function ($app) {
return new \Swift_Transport_SpoolTransport($app['swiftmailer.transport.eventdispatcher'], $app['swiftmailer.spool']);
});
use gcrico\SwiftMailerPsrLoggerPlugin\SwiftMailerPsrLoggerPlugin;
$app->extend('mailer', function ($mailer) use ($app) {
$app_logger = $app['logger'];
$mailer_logger = new SwiftMailerPsrLoggerPlugin($app_logger);
$mailer->registerPlugin($mailer_logger);
return $mailer;
});
bash
php composer.phar
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.