germania-kg / swiftmailer-callable
Installs: 619
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
pkg:composer/germania-kg/swiftmailer-callable
Requires
- php: ^5.6|^7.0|^8.0
- psr/log: ^1.0
- swiftmailer/swiftmailer: ^5.4|^6.0
Requires (Dev)
- php-coveralls/php-coveralls: ^2.0
- phpspec/prophecy-phpunit: ^2.0
- phpunit/phpunit: ^9.0
README
Callable wrapper around sending emails with SwiftMailer
Installation
$ composer require germania-kg/swiftmailer-callable
Usage
<?php use Germania\SwiftMailerCallable\SwiftMailerCallable; // Dependencies $swift_mailer = Swift_Mailer::newInstance( ... ); $message_factory = function() { return Swift_Message::newInstance( ... ); }); // Setup callable, optionally with PSR-3 Logger $mailer = new SwiftMailerCallable( $swift_mailer, $message_factory ); $mailer = new SwiftMailerCallable( $swift_mailer, $message_factory, $logger ); // PSR-3 LoggerAwareInterface $mailer->setLogger( $logger ); // Prepare sending $subject = 'My mail subject'; $body = 'Any mail text'; // Go! - Optionally pass recipient, if not already set in factory $sent = $mailer( $subject, $body ); $sent = $mailer( $subject, $body, ['me@test.com' => 'Joen Doe'] );
Issues
See issues list.
Development
$ git clone https://github.com/GermaniaKG/SwiftMailerCallable.git
$ cd SwiftMailerCallable
$ composer install
Unit tests
Either copy phpunit.xml.dist to phpunit.xml and adapt to your needs, or leave as is. Run PhpUnit test or composer scripts like this:
$ composer test # or $ vendor/bin/phpunit