PHPackages                             bravesheep/mailer-url-bundle - 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. bravesheep/mailer-url-bundle

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

bravesheep/mailer-url-bundle
============================

Determine Symfony2 mailer settings from a single URL-based parameter

v0.2.0(6y ago)027.9k↓23.3%11MITPHP

Since May 21Pushed 6y ago3 watchersCompare

[ Source](https://github.com/bravesheep/mailer-url-bundle)[ Packagist](https://packagist.org/packages/bravesheep/mailer-url-bundle)[ RSS](/packages/bravesheep-mailer-url-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (4)Used By (1)

BravesheepMailerUrlBundle
=========================

[](#bravesheepmailerurlbundle)

A Symfony2 bundle for parsing the contents of a url that specifies which mailer to use.

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

[](#installation-and-configuration)

Using [Composer](https://getcomposer.org/) add the bundle to your dependencies using the require command: `composer require bravesheep/mailer-url-bundle:dev-master`.

### Add the bundle to your AppKernel

[](#add-the-bundle-to-your-appkernel)

Add the bundle in your `app/AppKernel.php`. **Note**: in order for the parameters defined by this bundle to be picked up by Swiftmailer, you need to include this bundle before including the `Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle` bundle.

```
public function registerBundles()
{
    return array(
        // ...
        new Bravesheep\MailerUrlBundle\BravesheepMailerUrlBundle(),
        // ...
    );
}
```

### Configure which urls should be rewritten to parameters

[](#configure-which-urls-should-be-rewritten-to-parameters)

For this bundle to work you need to specify which urls need to be rewritten to basic parameters. This bundle can handle any number of urls by configuring the correct properties under `bravesheep_mailer_url.urls`. Take a look at this example configuration:

```
bravesheep_mailer_url:
    urls:
        default:
            url: %mailer_url%
            prefix: mailer_
```

In this case we take the value of the `mailer_url` parameter and create parameters from it prefixed with `mailer_`.

Usage
-----

[](#usage)

Take a look at this `parameters.yml.dist` which is distributed by the Symfony2 Standard Edition:

```
parameters:
    database_driver: pdo_mysql
    database_host: 127.0.0.1
    database_port: ~
    database_name: symfony
    database_user: root
    database_password: ~

    mailer_transport: smtp
    mailer_host: 127.0.0.1
    mailer_user: ~
    mailer_password: ~

    locale: en
    secret: ThisTokenIsNotSoSecretChangeIt

    debug_toolbar: true
    debug_redirects: false
    use_assetic_controller: true
```

As you can see we need 4 parameters to specify the smtp settings, and that doesn't even include setting the port, encryption or authentication methods in the case of SMTP (which might actually vary on different environments). It would be nice if we could reduce the number of parameters required and specify which mailer to use by specifying a single URL:

```
parameters:
    database_driver: pdo_mysql
    database_host: 127.0.0.1
    database_port: ~
    database_name: symfony
    database_user: root
    database_password: ~

    mailer_url: smtp://127.0.0.1

    locale: en
    secret: ThisTokenIsNotSoSecretChangeIt

    debug_toolbar: true
    debug_redirects: false
    use_assetic_controller: true
```

Still easily readable, but a lot more concise. The BravesheepMailerUrlBundle can do exactly this. Given the configuration as shown in the previous section and this configuration the bundle uses `mailer_url` to create the
`mailer_transport` and `mailer_host` with the correct data.

In general this bundle takes any valid mailer url and creates the following parameters, prefixed with the specified prefix: `transport`, `host`, `port`, `user`, `password`, `encryption` and `auth_mode`.

### Accepted URLs

[](#accepted-urls)

URLs are generally formatted in `scheme://user:password@host:port` format. The following schemes are understood:

- `smtp` for basic SMTP
- `smtp+ssl` or `ssl+smtp` for SMTP with SSL encryption
- `smtp+tls` or `tls+smtp` for SMTP with TLS encryption
- `gmail` for the GMail mail transport provided by Symfony
- `mail` for using the internal `mail()` function in PHP
- `sendmail` for using the sendmail binary your system provides

The `encryption` (besides using the scheme, which is preferred) and `auth_mode` parameters can be specified via query parameters, for example: `smtp://user:pass@localhost/?encryption=tls&auth_mode=plain`. Valid values for `auth_mode` are `plain`, `login` and `cram-md5`.

Gmail URLs may be specified by leaving the everything after the authentication string out, for example: `gmail://user@gmail.com:password`. For mail and sendmail you can use: `mail://` or `mail`, and `sendmail://` or `sendmail`respectively.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 71.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 ~945 days

Total

3

Last Release

2489d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/86a9633404b0317dcde9ecb9c54f88c4d54bc42bb137d462933773bbe3a539b9?d=identicon)[rnijveld](/maintainers/rnijveld)

![](https://www.gravatar.com/avatar/664f27a4241e63b3e2cff68a436e2ef6930c926dd0ae0fb4973bfb969cab1754?d=identicon)[marlon](/maintainers/marlon)

---

Top Contributors

[![rnijveld](https://avatars.githubusercontent.com/u/193783?v=4)](https://github.com/rnijveld "rnijveld (5 commits)")[![hdoordt](https://avatars.githubusercontent.com/u/17907879?v=4)](https://github.com/hdoordt "hdoordt (1 commits)")[![marlonbaeten](https://avatars.githubusercontent.com/u/885089?v=4)](https://github.com/marlonbaeten "marlonbaeten (1 commits)")

### Embed Badge

![Health badge](/badges/bravesheep-mailer-url-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/bravesheep-mailer-url-bundle/health.svg)](https://phpackages.com/packages/bravesheep-mailer-url-bundle)
```

###  Alternatives

[symfony/security-bundle

Provides a tight integration of the Security component into the Symfony full-stack framework

2.5k172.9M1.8k](/packages/symfony-security-bundle)[sonata-project/entity-audit-bundle

Audit for Doctrine Entities

644989.8k1](/packages/sonata-project-entity-audit-bundle)[php-flasher/flasher-symfony

Integrate flash notifications into Symfony projects effortlessly with PHPFlasher. Improve user experience and application feedback loops easily.

141.3M20](/packages/php-flasher-flasher-symfony)[cspoo/swiftmailer-mailgun-bundle

Swiftmailer Mailgun bundle

1031.1M](/packages/cspoo-swiftmailer-mailgun-bundle)

PHPackages © 2026

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