tystr / TystrSendgridBundle

A simple bundle for integrating the Sendgrid PHP library into the Symfony2 framework.
MIT License
7 stars 5 forks source link

Setting options on the SendGrid object #1

Open pdesmarais opened 10 years ago

pdesmarais commented 10 years ago

Hi there,

The SendGrid docs say that we can specify options on the SendGrid object with an array of options as the third argument to the __construct(). See https://github.com/sendgrid/sendgrid-php/blob/master/README.md#options

How could that be done using your service?

Thanks!

pdesmarais commented 10 years ago

Your config supports 2 arguments other than username or password:

->booleanNode('turn_off_ssl_verification')->end()
->booleanNode('enable_short_alias')->defaultTrue()->end()

Do you think this should be done using an array instead which would futureproof the functionality if SendGrid adds more available options in the future?

hackzilla commented 8 years ago

I'd override the service definition, so you could pass in your own options.

        <service id="tystr_sendgrid.sendgrid" class="%tystr_sendgrid.sendgrid.class%">
            <argument>%tystr_sendgrid.username%</argument>
            <argument>%tystr_sendgrid.password%</argument>
        </service>
hackzilla commented 8 years ago

in services.yml

    tystr_sendgrid.sendgrid:
        class: '%tystr_sendgrid.sendgrid.class%'
        arguments:
            - '%tystr_sendgrid.username%'
            - '%tystr_sendgrid.password%'
            -
                enable_guzzle_exceptions: false
                turn_off_ssl_verification: false
                raise_exceptions: false