PHPackages                             starstruck0207/swiftmailerdbbundle - 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. starstruck0207/swiftmailerdbbundle

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

starstruck0207/swiftmailerdbbundle
==================================

Database spooling for SwiftMailer

1.1.2(7y ago)01.4k1MITPHPPHP &gt;=7.1

Since Jul 29Pushed 7y agoCompare

[ Source](https://github.com/starstruck0207/WhiteOctoberSwiftMailerDBBundle)[ Packagist](https://packagist.org/packages/starstruck0207/swiftmailerdbbundle)[ RSS](/packages/starstruck0207-swiftmailerdbbundle/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (2)Versions (11)Used By (0)

SwiftMailerDBBundle
===================

[](#swiftmailerdbbundle)

[![Latest Stable Version](https://camo.githubusercontent.com/5bb692d836923fb12551982ffa92f0e1ae00aa923978e139a969cd130c68b4ce/68747470733a2f2f706f7365722e707567782e6f72672f77686974656f63746f6265722f73776966746d61696c6572646262756e646c652f762f737461626c65)](https://packagist.org/packages/whiteoctober/swiftmailerdbbundle)[![Total Downloads](https://camo.githubusercontent.com/cb8c8354a63c2d95d8aadbc623549f172cf30378797c51a2646fc260809940b0/68747470733a2f2f706f7365722e707567782e6f72672f77686974656f63746f6265722f73776966746d61696c6572646262756e646c652f646f776e6c6f616473)](https://packagist.org/packages/whiteoctober/swiftmailerdbbundle)[![Monthly Downloads](https://camo.githubusercontent.com/7c1a1881301129cb1246fd897bdda981ff2d68d860d3515d2dd1d1fd78c220f6/68747470733a2f2f706f7365722e707567782e6f72672f77686974656f63746f6265722f73776966746d61696c6572646262756e646c652f642f6d6f6e74686c79)](https://packagist.org/packages/whiteoctober/swiftmailerdbbundle)[![License](https://camo.githubusercontent.com/5750d5c8c2762f069adaec2a0375a3463b379f69abfaf4f2c3a719481a18d8d8/68747470733a2f2f706f7365722e707567782e6f72672f77686974656f63746f6265722f73776966746d61696c6572646262756e646c652f6c6963656e7365)](https://packagist.org/packages/whiteoctober/swiftmailerdbbundle)

[![SwiftMailer](https://camo.githubusercontent.com/9f19deb223369a184cbe1d93c682140f8bcb88012f842e8e693f0bfeff37bf3e/687474703a2f2f73776966746d61696c65722e6f72672f696d616765732f6c6f676f2e706e67)](https://camo.githubusercontent.com/9f19deb223369a184cbe1d93c682140f8bcb88012f842e8e693f0bfeff37bf3e/687474703a2f2f73776966746d61696c65722e6f72672f696d616765732f6c6f676f2e706e67)

This bundle faciliates using a database to spool messages to with SwiftMailer and Symfony2.

At present, it only works with the Doctrine EntityManager and entities managed with this.

Installation and configuration
------------------------------

[](#installation-and-configuration)

### 1. Install via Composer

[](#1-install-via-composer)

```
$ composer require "whiteoctober/swiftmailerdbbundle:^1.0"
```

### 2. Add the bundle to your application's kernel

[](#2-add-the-bundle-to-your-applications-kernel)

```
// app/AppKernel.php
public function registerBundles()
{
    return array(
        // ...
        new WhiteOctober\SwiftMailerDBBundle\WhiteOctoberSwiftMailerDBBundle(),
        // ...
    );
}
```

### 3. Configure the `white_october_swift_mailer_db` in config.yml

[](#3-configure-the-white_october_swift_mailer_db-in-configyml)

```
white_october_swift_mailer_db:
    entity_class: AppBundle\Entity\Email
```

Read below about how to construct this entity.

### 4. Tell SwiftMailer to use the database spooler

[](#4-tell-swiftmailer-to-use-the-database-spooler)

```
swiftmailer:
    spool:
        type: db
```

That's it for bundle installation and configuration.

Mail entity
-----------

[](#mail-entity)

You will need to create an entity that can be persisted and that extends from the `EmailInterface` interface in the bundle. At the moment, the bundle expects a property to be available on your entity called 'status', since this field is queried.

Once you have your entity all set up, use the full namespaced path in your `config.yml`configuration as detailed above.

Optional: keeping sent messages in the database
-----------------------------------------------

[](#optional-keeping-sent-messages-in-the-database)

By default, messages which were succesfully sent will be deleted from the database. It is possible to configure the bundle to keep those messages in your config.yml:

```
white_october_swift_mailer_db:
    keep_sent_messages: true
```

Optional: using separate entity manager for emails
--------------------------------------------------

[](#optional-using-separate-entity-manager-for-emails)

When a message is sent with configured database spool `$em->flush` is called on default entity manager. This may cause side effects, so in order to flush only Email entity, put it in a separate bundle and configure separate entity manager for that bundle. For example:

```
white_october_swift_mailer_db:
    entity_class: MailBundle\Entity\Email

doctrine:
    orm:
        entity_managers:
            default:
                connection: default
                auto_mapping: true
            mail:
                connection: default
                mappings:
                    MailBundle: ~

```

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

[](#contributing)

We welcome contributions to this project, including pull requests and issues (and discussions on existing issues).

If you'd like to contribute code but aren't sure what, the [issues list](https://github.com/whiteoctober/WhiteOctoberSwiftMailerDBBundle/issues) is a good place to start. If you're a first-time code contributor, you may find Github's guide to [forking projects](https://guides.github.com/activities/forking/) helpful.

All contributors (whether contributing code, involved in issue discussions, or involved in any other way) must abide by our [code of conduct](https://github.com/whiteoctober/open-source-code-of-conduct/blob/master/code_of_conduct.md).

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 51.4% 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 ~263 days

Recently: every ~347 days

Total

8

Last Release

2823d ago

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

1.1.1PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/e2ca9f6cb7e23a9e0ab9c026a18fac3a448d4887cc9bcf2de52c68589b2c51c8?d=identicon)[atom](/maintainers/atom)

---

Top Contributors

[![richsage](https://avatars.githubusercontent.com/u/231551?v=4)](https://github.com/richsage "richsage (19 commits)")[![dfridrich](https://avatars.githubusercontent.com/u/3758421?v=4)](https://github.com/dfridrich "dfridrich (9 commits)")[![jmwamser](https://avatars.githubusercontent.com/u/5393615?v=4)](https://github.com/jmwamser "jmwamser (3 commits)")[![garak](https://avatars.githubusercontent.com/u/179866?v=4)](https://github.com/garak "garak (1 commits)")[![lenar](https://avatars.githubusercontent.com/u/281544?v=4)](https://github.com/lenar "lenar (1 commits)")[![choonge](https://avatars.githubusercontent.com/u/334814?v=4)](https://github.com/choonge "choonge (1 commits)")[![sam0delkin](https://avatars.githubusercontent.com/u/1104333?v=4)](https://github.com/sam0delkin "sam0delkin (1 commits)")[![dp-nfq](https://avatars.githubusercontent.com/u/126863663?v=4)](https://github.com/dp-nfq "dp-nfq (1 commits)")[![falinsky](https://avatars.githubusercontent.com/u/859638?v=4)](https://github.com/falinsky "falinsky (1 commits)")

---

Tags

doctrineswiftmailerspool

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/starstruck0207-swiftmailerdbbundle/health.svg)

```
[![Health](https://phpackages.com/badges/starstruck0207-swiftmailerdbbundle/health.svg)](https://phpackages.com/packages/starstruck0207-swiftmailerdbbundle)
```

###  Alternatives

[doctrine/common

PHP Doctrine Common project is a library that provides additional functionality that other Doctrine projects depend on such as better reflection support, proxies and much more.

5.8k363.3M1.2k](/packages/doctrine-common)[gedmo/doctrine-extensions

Doctrine behavioral extensions

4.1k118.8M365](/packages/gedmo-doctrine-extensions)[symfony/property-info

Extracts information about PHP class' properties using metadata of popular sources

2.2k256.7M853](/packages/symfony-property-info)[beberlei/doctrineextensions

A set of extensions to Doctrine 2 that add support for additional query functions available in MySQL, Oracle, PostgreSQL and SQLite.

2.1k75.1M146](/packages/beberlei-doctrineextensions)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[carbonphp/carbon-doctrine-types

Types to use Carbon in Doctrine

213220.4M8](/packages/carbonphp-carbon-doctrine-types)

PHPackages © 2026

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