PHPackages                             miradnan/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. miradnan/yii2-sendgrid

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

miradnan/yii2-sendgrid
======================

PHP 5.6+ Sendgrid integration for the Yii framework

1.1.2(8y ago)04471BSD-3-ClausePHPPHP &gt;=5.6.0

Since Nov 2Pushed 8y ago1 watchersCompare

[ Source](https://github.com/miradnan/yii2-sendgrid)[ Packagist](https://packagist.org/packages/miradnan/yii2-sendgrid)[ RSS](/packages/miradnan-yii2-sendgrid/feed)WikiDiscussions devel Synced yesterday

READMEChangelog (2)Dependencies (3)Versions (10)Used By (0)

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

[](#sendgrid-yii2-integration)

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

[![Latest Stable Version](https://camo.githubusercontent.com/603684f620b5b046d2ee249b5d054af3cd689de888cf6eee20352886a388d94a/68747470733a2f2f706f7365722e707567782e6f72672f737765656c69782f796969322d73656e64677269642f762f737461626c65)](https://packagist.org/packages/sweelix/yii2-sendgrid)[![Build Status](https://camo.githubusercontent.com/ea6c829cca65f3c96981ea522a9085481722ba6367ea063734038bf2e1c6480a/68747470733a2f2f6170692e7472617669732d63692e6f72672f706761756c746965722f796969322d73656e64677269642e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/pgaultier/yii2-sendgrid)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/79b325cd532056989db189b0b2a2b7d1662442a40c329f46d998c8bd1e4377a8/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f706761756c746965722f796969322d73656e64677269642f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/pgaultier/yii2-sendgrid/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/f9bae13e427131eec6a1fe8f78432a052a5684ae2fd7fd480764e47fbf2e4d68/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f706761756c746965722f796969322d73656e64677269642f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/pgaultier/yii2-sendgrid/?branch=master)[![License](https://camo.githubusercontent.com/0feef7ba6dd3ccfab5ab8848297318561bb23b166516c76c36b4ae72242a6494/68747470733a2f2f706f7365722e707567782e6f72672f737765656c69782f796969322d73656e64677269642f6c6963656e7365)](https://packagist.org/packages/sweelix/yii2-sendgrid)

[![Latest Development Version](https://camo.githubusercontent.com/da9290457cc26b65f8faba577f924f94512f24929311567c357a38320d6772fd/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f756e737461626c652d646576656c2d79656c6c6f77677265656e2e737667)](https://packagist.org/packages/sweelix/yii2-sendgrid)[![Build Status](https://camo.githubusercontent.com/c3e914405dd9c00112b0311ede294d79dea684aefdecc9cc206de665a63529a4/68747470733a2f2f7472617669732d63692e6f72672f706761756c746965722f796969322d73656e64677269642e7376673f6272616e63683d646576656c)](https://travis-ci.org/pgaultier/yii2-sendgrid)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/0eefa7de7c2945967feb32924967b8aa31eff0c3ac1a9a35c4fd93d40e37606a/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f706761756c746965722f796969322d73656e64677269642f6261646765732f7175616c6974792d73636f72652e706e673f623d646576656c)](https://scrutinizer-ci.com/g/pgaultier/yii2-sendgrid/?branch=devel)[![Code Coverage](https://camo.githubusercontent.com/4308dd73313fe3d3deaad0cbd2290e995f39ec00dbd3801b3144ada3a7e7d703/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f706761756c746965722f796969322d73656e64677269642f6261646765732f636f7665726167652e706e673f623d646576656c)](https://scrutinizer-ci.com/g/pgaultier/yii2-sendgrid/?branch=devel)

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

[](#installation)

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

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

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

[](#howto-use-it)

Add extension to your configuration

```
return [
    //....
    'components' => [
        'mailer' => [
            'class' => 'sweelix\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

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 88.1% 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 ~51 days

Total

6

Last Release

3265d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/397415?v=4)[Mir Adnan](/maintainers/miradnan)[@miradnan](https://github.com/miradnan)

---

Top Contributors

[![pgaultier](https://avatars.githubusercontent.com/u/545714?v=4)](https://github.com/pgaultier "pgaultier (37 commits)")[![miradnan](https://avatars.githubusercontent.com/u/397415?v=4)](https://github.com/miradnan "miradnan (3 commits)")[![SriCloud](https://avatars.githubusercontent.com/u/17287695?v=4)](https://github.com/SriCloud "SriCloud (2 commits)")

---

Tags

mailemailsendgridmaileryii2

###  Code Quality

TestsCodeception

### Embed Badge

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

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

###  Alternatives

[boundstate/yii2-mailgun

Mailgun integration for the Yii framework

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

Mailgun mailer implementation for Yii2

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

PHPackages © 2026

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