PHPackages                             pixelcreart/yii2-sendgrid - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. pixelcreart/yii2-sendgrid

ActiveYii2-extension[Mail &amp; Notifications](/categories/mail)

pixelcreart/yii2-sendgrid
=========================

PHP 8.1+ Sendgrid integration for the Yii framework

1.0.4(2y ago)147BSD-3-ClausePHPPHP &gt;=8.1.0

Since Feb 8Pushed 2y ago1 watchersCompare

[ Source](https://github.com/pixelcreart/yii2-sendgrid)[ Packagist](https://packagist.org/packages/pixelcreart/yii2-sendgrid)[ RSS](/packages/pixelcreart-yii2-sendgrid/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (3)Versions (8)Used By (0)

Sendgrid Yii2 integration
=========================

[](#sendgrid-yii2-integration)

This extension allow the developer to use [Sendgrid](https://sendgrid.com/) as an email transport.

[![Latest Stable Version](https://camo.githubusercontent.com/2214974886c58ebc64563ba1e34fe0e4834f9b2ad18b8a1a6e501cfbcd6d242f/68747470733a2f2f706f7365722e707567782e6f72672f706978656c6372656172742f796969322d73656e64677269642f762f737461626c65)](https://packagist.org/packages/pixelcreart/yii2-sendgrid)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/968619ed1d9475f339620e6fbc3a00122f140eefb9bf4267c4002e1ad9acfa75/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f706978656c6372656172742f796969322d73656e64677269642f6261646765732f7175616c6974792d73636f72652e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/pixelcreart/yii2-sendgrid/?branch=main)[![Code Coverage](https://camo.githubusercontent.com/7d389bdddeb1fedfc55a3fdede040a3d6d549e13de60b6b594fc76e95eb4bbfd/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f706978656c6372656172742f796969322d73656e64677269642f6261646765732f636f7665726167652e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/pixelcreart/yii2-sendgrid/?branch=main)[![License](https://camo.githubusercontent.com/6c40387aa7d0b802b06efbcbe92710bf6f0165270f92822257c41566d95bcf1f/68747470733a2f2f706f7365722e707567782e6f72672f706978656c6372656172742f796969322d73656e64677269642f6c6963656e7365)](https://packagist.org/packages/pixelcreart/yii2-sendgrid)

[![Latest Development Version](https://camo.githubusercontent.com/da9290457cc26b65f8faba577f924f94512f24929311567c357a38320d6772fd/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f756e737461626c652d646576656c2d79656c6c6f77677265656e2e737667)](https://packagist.org/packages/pixelcreart/yii2-sendgrid)[![Build Status](https://camo.githubusercontent.com/6369e34c5595b47cb126fc026c2004d6e123e9e0ac9af768b55137ef15c57e31/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f706978656c6372656172742f796969322d73656e64677269642f6261646765732f6275696c642e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/pixelcreart/yii2-sendgrid/build-status/main)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/ed90440ff204a84efbd2eadc4cd13cd66ae7e19e68490f4f812200d376688a24/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f706978656c6372656172742f796969322d73656e64677269642f6261646765732f7175616c6974792d73636f72652e706e673f623d646576656c6f70)](https://scrutinizer-ci.com/g/pixelcreart/yii2-sendgrid/?branch=develop)[![Build Status](https://camo.githubusercontent.com/f9ab72a44787c1c0d4d33f95295dd5d0cb5c51ac6e198a3c3cb760cabf0192f5/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f706978656c6372656172742f796969322d73656e64677269642f6261646765732f6275696c642e706e673f623d646576656c6f70)](https://scrutinizer-ci.com/g/pixelcreart/yii2-sendgrid/build-status/develop)

Installation
------------

[](#installation)

If you use Packagist for installing packages, then you can update your composer.json like this :

```
{
    "require": {
        "pixelcreart/yii2-sendgrid": "*"
    }
}
```

Howto use it
------------

[](#howto-use-it)

Add extension to your configuration

```
return [
    //....
    'components' => [
        'mailer' => [
            'class' => 'pixelcreart\sendgrid\Mailer',
            'token' => '',
        ],
    ],
];
```

You can send email as follow (using postmark templates)

```
Yii::$app->mailer->compose('contact/html')
     ->setFrom('from@domain.com')
     ->setTo($form->email)
     ->setSubject($form->subject)
     ->setTemplateId(12345)
     ->setTemplateModel([
         'firstname' => $form->firstname,
         'lastname' => $form->lastname,
     ])
     ->send();
```

For further instructions refer to the [related section in the Yii Definitive Guide](http://www.yiiframework.com/doc-2.0/guide-tutorial-mailing.html)

Running the tests
-----------------

[](#running-the-tests)

Before running the tests, you should edit the file tests/\_bootstrap.php and change the defines :

```
// ...
define('SENDGRID_FROM', '');
define('SENDGRID_TOKEN', '');
define('SENDGRID_TO', '');
define('SENDGRID_TEMPLATE', 575741);

define('SENDGRID_TEST_SEND', false);
// ...
```

to match your [Sendgrid](https://sendgrid.com/) configuration.

Contributing
------------

[](#contributing)

All code contributions - including those of people having commit access - must go through a pull request and approved by a core developer before being merged. This is to ensure proper review of all the code.

Fork the project, create a [feature branch](http://nvie.com/posts/a-successful-git-branching-model/), and send us a pull request.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

5

Last Release

823d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.6.0

1.0.1PHP &gt;=8.1.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/9896d4ace701609b96b837fd5ceaeddd040cbb4fd3d71c531e24e17774055493?d=identicon)[mavelar](/maintainers/mavelar)

---

Top Contributors

[![mavelar](https://avatars.githubusercontent.com/u/737470?v=4)](https://github.com/mavelar "mavelar (9 commits)")

---

Tags

mailemailsendgridmaileryii2

###  Code Quality

TestsCodeception

### Embed Badge

![Health badge](/badges/pixelcreart-yii2-sendgrid/health.svg)

```
[![Health](https://phpackages.com/badges/pixelcreart-yii2-sendgrid/health.svg)](https://phpackages.com/packages/pixelcreart-yii2-sendgrid)
```

###  Alternatives

[boundstate/yii2-mailgun

Mailgun integration for the Yii framework

28160.6k](/packages/boundstate-yii2-mailgun)[yarcode/yii2-mailgun-mailer

Mailgun mailer implementation for Yii2

1576.0k](/packages/yarcode-yii2-mailgun-mailer)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
