GithubHelp home page GithubHelp logo

notifire-bundle's Introduction

Notifire Bundle

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 >= 5.5.0
  • symfony/symfony >= 2.7
  • 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('[email protected]')
    ->addTo('[email protected]')
    ->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

notifire-bundle's People

Contributors

alekitto avatar giovannialbero1992 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.