yii-extension/mailer-service

There is no license information available for the latest version (dev-master) of this package.

Yii3 Mailer Services

This package's canonical repository appears to be gone and the package has been frozen as a result.

dev-master / 1.0.x-dev 2020-12-25 13:23 UTC

README

68747470733a2f2f6c68332e676f6f676c6575736572636f6e74656e742e636f6d2f65685354506e5871726b6b304d33552d5550436a4330667479394b366c67796b4b32574f5541326e5548703867496b526a65544e387a385341426c6b766376522d39504972626f7849765047756a50675765624c51654848675837794c556f7846536475695a72546f6736576f5a4c694176716354523151545056526d6e733274596a414370703745513d7732343030

Mailer services


Total Downloads build codecov Mutation testing badge static analysis type-coverage

Requirements

The minimum requirement by this project template that your Web server supports PHP 7.4.0.

Installation

composer require yii-extension/mailer-service

Usages:

You can inject mailer-service into the controller or action, and automatically all dependencies are resolved by autowired in di-container.

public function contact(
    MailerService $mailer,
    ServerRequestInterface $request,
): ResponseInterface {
    $mailer->run(
        'test@example.com', // from
        'admin1@example.com', // to
        'TestMe', // subject
        '@mail', // path mail
        [ 'html' => 'contact'], // name layout
        [ // params
            'username' => 'User',
            'body' => 'TestMe',
        ],
        $request->getUploadedFiles(), // attach files
    );
}

Unit testing

The package is tested with PHPUnit. To run tests:

./vendor/bin/phpunit

Mutation testing

The package tests are checked with roave-infection-static-analysis-plugin mutation framework. To run it:

./vendor/bin/roave-infection-static-analysis-plugin

Static analysis

The code is statically analyzed with Psalm. To run static analysis:

./vendor/bin/psalm