PHPackages                             libreworks/swiftmailer-spools - 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. [Database &amp; ORM](/categories/database)
4. /
5. libreworks/swiftmailer-spools

ActiveLibrary[Database &amp; ORM](/categories/database)

libreworks/swiftmailer-spools
=============================

Additional spools for use with the SwiftMailer library

2.0.0(8y ago)315.2k1[1 PRs](https://github.com/libreworks/swiftmailer-spools/pulls)MITPHPPHP &gt;=7.0.0

Since Feb 11Pushed 6y ago1 watchersCompare

[ Source](https://github.com/libreworks/swiftmailer-spools)[ Packagist](https://packagist.org/packages/libreworks/swiftmailer-spools)[ Docs](http://github.com/libreworks/swiftmailer-spools)[ RSS](/packages/libreworks-swiftmailer-spools/feed)WikiDiscussions master Synced 1mo ago

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

swiftmailer-spools
==================

[](#swiftmailer-spools)

Additional spools for use with the SwiftMailer library.

This includes spools for PDO and MongoDB.

[![Packagist](https://camo.githubusercontent.com/f9ac2df49d845d589ee8d27a862ddd7091bf361dd81c1897141f2c48b2398a3c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c69627265776f726b732f73776966746d61696c65722d73706f6f6c732e737667)](https://packagist.org/packages/libreworks/swiftmailer-spools)[![Build Status](https://camo.githubusercontent.com/1e101f2b97e12c1daee9cc9b791ae6fe6cc4c6fb1edfa61cb98e605715258066/68747470733a2f2f7472617669732d63692e6f72672f6c69627265776f726b732f73776966746d61696c65722d73706f6f6c732e737667)](https://travis-ci.org/libreworks/swiftmailer-spools)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/dbd2546e50c3b6ab16ab4d043331bffe42dfeda45e94c7e0dcd042bcaad49c6c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6c69627265776f726b732f73776966746d61696c65722d73706f6f6c732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/libreworks/swiftmailer-spools/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/2eb1e01c12dc40d39195f6c646fb753f5d734c739ff3ed3d86441c4b54b0932c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6c69627265776f726b732f73776966746d61696c65722d73706f6f6c732f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/libreworks/swiftmailer-spools/?branch=master)

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

[](#installation)

You can install this library using Composer:

```
$ composer require libreworks/swiftmailer-spools
```

- The master branch (version 2.x) of this project depends on SwiftMailer 6.0+, which requires PHP 7.0.
- Version 1.x of this project depends on SwiftMailer 5.4+, which requires PHP 5.3. It also runs just fine on HHVM.

Compliance
----------

[](#compliance)

Releases of this library will conform to [Semantic Versioning](http://semver.org).

Our code is intended to comply with [PSR-1](http://www.php-fig.org/psr/psr-1/) and [PSR-2](http://www.php-fig.org/psr/psr-2/). If you find any issues related to standards compliance, please send a pull request!

Examples
--------

[](#examples)

Here's how to instantiate a `Swift_Mailer` object that uses the spools to send.

```
$mailer = \Swift_Mailer::newInstance(
    \Swift_SpoolTransport::newInstance(
        $spool // your spool goes here
    )
);
// this e-mail will get spooled
$mailer->send(new \Swift_Message($subject, $body, $contentType, $charset));
```

Here's how to instantiate a `Swift_Transport` to send spooled e-mails.

```
$transport = \Swift_SmtpTransport::newInstance($smtpHost, $smtpPort, $smtpEncrypt)
    ->setUsername($smtpUsername)
    ->setPassword($smtpPassword);

$spool->recover();
$spool->flushQueue($transport);
```

### PDO Spool

[](#pdo-spool)

```
$pdo = new \PDO("mysql:dbname=testdb;host=127.0.0.1", 'user', 'pass');
$spool = new \Swift_PdoSpool(
    $pdo,
    "email", // table
    "id", // primary key field
    "message", // serialized email field
    "sentOn", // sent integer timestamp
);
```

### MongoDB Spool

[](#mongodb-spool)

```
$manager = new \MongoDB\Driver\Manager("mongodb://localhost:27017");
$rp = new \MongoDB\Driver\ReadPreference(\MongoDB\Driver\ReadPreference::RP_PRIMARY_PREFERRED);
$wr = new \MongoDB\Driver\WriteConcern(\MongoDB\Driver\WriteConcern::MAJORITY);
$spool = new \Swift_MongoDbSpool(
    $manager,
    "dbname.emails",
    $rp, // optional
    $wc, // optional
);
```

### Mongo Spool (deprecated in 1.x; removed in 2.x)

[](#mongo-spool-deprecated-in-1x-removed-in-2x)

```
$client = new \MongoClient();
$db = new \MongoDB("dbname", $client);
$collection = new \MongoCollection($db, "emails");
$spool = new \Swift_MongoSpool($collection);
```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity61

Established project with proven stability

 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 ~243 days

Total

4

Last Release

3010d ago

Major Versions

1.0.x-dev → 2.0.02018-02-10

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

2.0.0PHP &gt;=7.0.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/659262eac941ffe4795493834425fc9a2369c2c9df3cc565ed4194f1d37be934?d=identicon)[doublecompile](/maintainers/doublecompile)

---

Top Contributors

[![doublecompile](https://avatars.githubusercontent.com/u/4267230?v=4)](https://github.com/doublecompile "doublecompile (8 commits)")

---

Tags

databasemailemailpdomailermongodb

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/libreworks-swiftmailer-spools/health.svg)

```
[![Health](https://phpackages.com/badges/libreworks-swiftmailer-spools/health.svg)](https://phpackages.com/packages/libreworks-swiftmailer-spools)
```

###  Alternatives

[moloquent/moloquent

A MongoDB based Eloquent model and Query builder for Laravel (Moloquent)

120114.6k7](/packages/moloquent-moloquent)

PHPackages © 2026

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