fazland / notifire-bundle
Installs: 5 498
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 5
Forks: 1
Open Issues: 0
Requires
- php: >= 7.0
- fazland/notifire: ^1.0
- symfony/framework-bundle: ^2.8|^3.0|^4.0
Requires (Dev)
- fazland/skebby-rest-client: ^0.2@dev
- mailgun/mailgun-php: ^2.4
- phpunit/phpunit: ^6.5
- symfony/asset: ^2.8|^3.0|^4.0
- symfony/browser-kit: ^2.8|^3.0|^4.0
- symfony/css-selector: ^2.3|^3.0|^4.0
- symfony/swiftmailer-bundle: ^2.6|^3.0
- symfony/templating: ^2.8|^3.0|^4.0
- symfony/twig-bundle: ^2.8|^3.0|^4.0
- twilio/sdk: ^5.0
Conflicts
- php-http/discovery: 1.5.*
- phpunit/phpunit: >=7.0
- symfony/dependency-injection: <2.7.1
- symfony/swiftmailer-bundle: <2.3.3
This package is auto-updated.
Last update: 2024-11-28 02:24:05 UTC
README
Notifire Bundle provides integration of Notifire library into the Symfony Framework.
Notifire is a PHP library that centralizes the management of notifications (e-mails, sms, push notifications, etc.), check its GitHub page to learn more.
Requirements
- php >= 7.0
- symfony/symfony >= 2.8
- fazland/notifire
Installation
The suggested installation method is via composer:
$ composer require fazland/notifire-bundle
Using Notifire Bundle
First of all, register NotifireBundle
in your AppKernel.php
:
public function registerBundles() { return [ // ... new NotifireBundle(), // ... ]; }
The configuration of Notifire Bundle is simple, just include in your app/config/config.xml
(or equivalent) something like the following:
<notifire:config> <notifire:email auto_configure_swiftmailer="true"> <notifire:mailer name="mailgun_example" provider="mailgun" api_key="api_key" domain="example.org" /> </notifire:email> <notifire:sms> <notifire:service name="default_sms" provider="twilio" username="%twilio_account_sid%" password="%twilio_auth_token%" sender="%twilio_from_phone%" /> </notifire:sms> </notifire:config>
YAML version:
notifire: email: auto_configure_swiftmailer: true mailers: mailgun_example: provider: mailgun api_key: api_key domain: example.org sms: services: default_sms: provider: twilio account_sid: '%twilio_account_sid%' auth_token: '%twilio_auth_token%' from_phone: '%twilio_from_phone%'
This configuration snippet registers in Notifire
all your existing SwiftMailer's mailers, the specified
Twilio's services and Mailgun's mailers.
If you want to register by instance only a set of SwiftMailer` mailers just use:
<!-- ... --> <notifire:email auto_configure_swiftmailer="false"> <notifire:mailer name="y_mail" provider="swiftmailer" mailer_name="%your_mailer%" /> </notifire:email> <!-- ... -->
or in YAML:
# ... email: auto_configure_swiftmailer: false mailers: y_mail: provider: swiftmailer mailer_name: '%your_mailer%' # ...
This configuration will provide Notifire
configured and set in your container and its handlers
ready to send your notifications!
As usual, just create an e-mail with Notifire::email()
and send it:
// Use 'default' mailer $email = Notifire::email('default'); $email ->addFrom('test@fazland.com') ->addTo('info@example.org') ->setSubject('Only wonderful E-mails with Notifire!') ->addPart(Part::create($body, 'text/html')) ->send() ;
Contributing
Contributions are welcome. Feel free to open a PR or file an issue here on GitHub!
License
Notifire Bundle is licensed under the MIT License - see the LICENSE file for details