PHPackages                             andrebian/sendgrid-transport-module - 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. andrebian/sendgrid-transport-module

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

andrebian/sendgrid-transport-module
===================================

Zend Framework 2 Module that provides SendGrid as a Transport for Mail.

09121PHP

Since Feb 25Pushed 9y ago1 watchersCompare

[ Source](https://github.com/andrebian/sendgrid-transport-module)[ Packagist](https://packagist.org/packages/andrebian/sendgrid-transport-module)[ RSS](/packages/andrebian-sendgrid-transport-module/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

SendGrid Transport Module for Zend Framework
============================================

[](#sendgrid-transport-module-for-zend-framework)

[![Latest Stable Version](https://camo.githubusercontent.com/77c37f517945bb408f2b8d8c0468bea7bf00fceb44cd9652ed965d264a7b1ff6/68747470733a2f2f706f7365722e707567782e6f72672f616e6472656269616e2f73656e64677269642d7472616e73706f72742d6d6f64756c652f762f737461626c65)](https://packagist.org/packages/andrebian/sendgrid-transport-module)[![Total Downloads](https://camo.githubusercontent.com/96fb1f58ccef570cd6164b18ccdd66761420d1b4595142ea91622f7a85bd2e10/68747470733a2f2f706f7365722e707567782e6f72672f616e6472656269616e2f73656e64677269642d7472616e73706f72742d6d6f64756c652f646f776e6c6f616473)](https://packagist.org/packages/andrebian/sendgrid-transport-module)[![Latest Unstable Version](https://camo.githubusercontent.com/7c85f7a0b440fefbba88e60b16f6c55ec4868a53609274f570ba69cdd3c3d724/68747470733a2f2f706f7365722e707567782e6f72672f616e6472656269616e2f73656e64677269642d7472616e73706f72742d6d6f64756c652f762f756e737461626c65)](https://packagist.org/packages/andrebian/sendgrid-transport-module)[![License](https://camo.githubusercontent.com/14b7dff753f777dcf61867a0b3f939a0436514167e6db7d63786ace16c7e331e/68747470733a2f2f706f7365722e707567782e6f72672f616e6472656269616e2f73656e64677269642d7472616e73706f72742d6d6f64756c652f6c6963656e7365)](https://packagist.org/packages/andrebian/sendgrid-transport-module)[![Codacy Badge](https://camo.githubusercontent.com/a4ea435fa7545023e43e1a4f951315172491dc1e5555b99483df4f1b4387306d/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f6233616564326536386234383439653962626239316437373630383962643436)](https://www.codacy.com/app/andrecardosodev/sendgrid-transport-module?utm_source=github.com&utm_medium=referral&utm_content=andrebian/sendgrid-transport-module&utm_campaign=Badge_Grade)[![Codacy Badge](https://camo.githubusercontent.com/bda06d672aafe0aec0d0763f8a2398df2e856aa7fbce4ca95fd6f7fc88c9ca8a/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f436f7665726167652f6233616564326536386234383439653962626239316437373630383962643436)](https://www.codacy.com/app/andrecardosodev/sendgrid-transport-module?utm_source=github.com&utm_medium=referral&utm_content=andrebian/sendgrid-transport-module&utm_campaign=Badge_Coverage)

This module provide SendGrid as a transport for transactional e-mail in Zend Framework 2.

INSTALLING
----------

[](#installing)

`composer require andrebian/sendgrid-transport-module`

After install follow one of these steps:

1. Copy the contents file `vendor/andrebian/sendgrid-transport-module/mail.global.php.dist` and put it in your `config/autoload/mail.global.php`.
2. If this file does not exists in your application, just copy the entire file and place into your `config/autoload` removing the .dist extension.

Then put your SendGrid API Key. To get your API Key, please visit [https://sendgrid.com/docs/Classroom/Send/How\_Emails\_Are\_Sent/api\_keys.html](https://sendgrid.com/docs/Classroom/Send/How_Emails_Are_Sent/api_keys.html)

```
// config/autoload/mail.global.php

return array(
    'mail' => array(
        'sendgrid' => array(
            'api_key' => 'YOUR_API_KEY',
        )
    )
);
```

After all, you must register `SendGridTransportModule` in your `config/application.config.php`.

```
// config/application.config.php
return [
    'modules' => [
        'YourPreviousModules',
        'SendGridTransportModule'
    ],
    'module_listener_options' => [
        'module_paths' => [
            './module',
            './vendor',
        ],
        'config_glob_paths' => [
            'config/autoload/{{,*.}global,{,*.}local}.php',
            'module/{*}/config/autoload/{{,*.}global,{,*.}local}.php',
        ],
    ]
];
```

USAGE
-----

[](#usage)

### Via Service

[](#via-service)

By default, when the **SendGridTransportModule** is loaded a service is registered and ready to use.

```
// In a Controller
$sendGridTransport = $this->getServiceLocator()->get('SendGridTransport');
```

#### Full example with service

[](#full-example-with-service)

```
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
use Zend\Mail;

class SomeController extends AbstractActionController
{
    public function someAction()
    {
        $mail = new Mail\Message();
        $mail->setBody('This is the text of the email.');
        $mail->setFrom(new Mail\Address('test@example.org', 'Sender\'s name'));
        $mail->addTo(new Mail\Address('some@address.com', 'User Name'));
        $mail->setSubject('TestSubject');

        $sendGridTransport = $this->getServiceLocator()->get('SendGridTransport');
        $sendGridTransport->send($mail);

        return new ViewModel();
    }
}
```

### Directly

[](#directly)

If you need more control, you can use the library anywhere you want.

```
use SendGrid;
use SendGridTransportModule\SendGridTransport;

class SomeControllerOrServiceOrHelper
{
    public function someMethod()
    {
        $mail = new Mail\Message();
        $mail->setBody('This is the text of the email.');
        $mail->setFrom(new Mail\Address('test@example.org', 'Sender\'s name'));
        $mail->addTo(new Mail\Address('some@address.com', 'User Name'));
        $mail->setSubject('TestSubject');

        $sendGrid = new SendGrid('YOUR_API_KEY');
        $sendGridEmail = new SendGrid\Email();
        $sendGridTransport = new SendGridTransport($sendGrid, $sendGridEmail);

        $sendGridTransport->send($mail);
    }
}
```

> Is strongly recommended to use the already registered service.

CONTRIBUTING
------------

[](#contributing)

You can contribute with this module suggesting improvements, making tests and reporting bugs. Use [issues](https://github.com/andrebian/sendgrid-transport-module/issues) for that.

LICENSE
-------

[](#license)

[MIT](https://github.com/andrebian/sendgrid-transport-module/blob/master/LICENSE)

ERRORS
------

[](#errors)

Report errors opening [Issues](https://github.com/andrebian/sendgrid-transport-module/issues).

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/97df5e6c6aeda1550e75a26b9614532cb5304961dea595f1aa1e4328a7d7cdff?d=identicon)[andrebian](/maintainers/andrebian)

---

Top Contributors

[![andrebian](https://avatars.githubusercontent.com/u/2091739?v=4)](https://github.com/andrebian "andrebian (21 commits)")

### Embed Badge

![Health badge](/badges/andrebian-sendgrid-transport-module/health.svg)

```
[![Health](https://phpackages.com/badges/andrebian-sendgrid-transport-module/health.svg)](https://phpackages.com/packages/andrebian-sendgrid-transport-module)
```

###  Alternatives

[mattketmo/email-checker

Throwaway email detection library

2752.1M5](/packages/mattketmo-email-checker)[sarfraznawaz2005/noty

Laravel package to incorporate noty flash notifications into laravel.

324.5k](/packages/sarfraznawaz2005-noty)

PHPackages © 2026

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