fazland / notifire
Installs: 5 989
Dependents: 1
Suggesters: 0
Security: 0
Stars: 3
Watchers: 4
Forks: 0
Open Issues: 0
pkg:composer/fazland/notifire
Requires
- php: >=7.0
- psr/log: ^1.0
- symfony/event-dispatcher: ^2.7|^3.0|^4.0
- symfony/options-resolver: ^2.7|^3.0|^4.0
Requires (Dev)
- fazland/skebby-rest-client: ^0.2@dev
- mailgun/mailgun-php: ^2.0
- mikey179/vfsstream: ^1.6
- phpunit/phpunit: ^6.0
- sendgrid/sendgrid: ^5.1
- swiftmailer/swiftmailer: ^5.4
- twig/twig: ^1.24
- twilio/sdk: ^4.10|^5.0
Suggests
- fazland/skebby-rest-client: Send SMS via Skebby
- mailgun/mailgun-php: Send emails via Mailgun
- sendgrid/sendgrid: Send email via Sendgrid
- twilio/sdk: Send SMS via Twilio
Conflicts
This package is auto-updated.
Last update: 2025-10-14 23:48:55 UTC
README
Notifire is a PHP library that centralizes the management of notifications (e-mails, sms, push notifications, etc.).
Requirements
php>= 7.2symfony/event-dispatcher>= 4.3symfony/options-resolver>= 4.3
Installation
The suggested installation method is via composer:
$ composer require fazland/notifire
Using Notifire
Every notification in Notifire triggers an Event (the NotifyEvent) which will be handled by an instance of NotifyEventSubscriber (later named by handlers).
Those notifications must implement NotificationInterface and registered with Notifire::addNotification() in order to be read by Notifire.
Notifire provides 2 standard implementations (Email and Sms) and theirs handlers (the defaults are SwiftMailerHandler and TwilioHandler).
Notifire is really simple to use:
Initialization
First of all Notifire has to be initialized. Two ways:
- run in order to autoconfigure the e-mail with SwiftMailer as its
Handler
Notifire::create();
- custom configuration with
NotifireBuilderby registering the notifications and the desired instance ofEventDispatcherInterface
require_once('vendor/autoload.php'); $dispatcher = new EventDispatcher(); $builder = NotifireBuilder::create() ->setDispatcher($dispatcher) ; $builder->addHandler(new SwiftMailerHandler($mailer, 'mailer_one')); $builder->addNotification('email', Email::class); $builder->initialize();
Now you're ready!
To create an Email just use Notifire::email(), fill the fields like from, to, parts etc. and then use Email::send():
// Use 'mailer_one' handler to send this message $email = Notifire::email('mailer_one'); $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 is licensed under the MIT License - see the LICENSE file for details