-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Description
Description
I'd like to be able to inject a custom transport factory when calling \Symfony\Component\Mailer\Transport::fromDsn
to add support for additional schemes, however the way that the Transport class is designed does not allow for additional factories to be specified, even if extended.
Example
For example I've developed a custom transport for amazon SES that utilizes the official SDK for authentication, I'd like to be able to configure this via DSN like so
Transport::fromDsn('ses+sdk://ACCESS_KEY:SECRET_KEY@default`)
If an additional parameter was added to allow an array containing a list of custom factory classes was added to these factory methods it would be quite useful in this situation
My proposed changes would be to alter the methods fromDsn
, fromDsns
and getDefaultFactories
to also accept an array custom factory classes, getDefaultFactories
would then yield a list of factories including both the default and custom factories, the method should be renamed at that point to getFactories
.
Now the following would be possible
Transport::fromDsn('ses+sdk://ACCESS_KEY:SECRET_KEY@default`, null, null, null, [
SesSdkTransport::class
]);
I'd be happy to submit a PR if this proposal sounds acceptable