News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

ServerGrove Blog:
Symfony2 components overview EventDispatcher
October 25, 2013 @ 11:52:31

The ServerGrove blog continues their spotlight on the various components that make up the Symfony2 framework in their latest post about the EventDispatcher.

For many years, in the PHP world we were used to code following a linear flow, where instructions were executed one after another, jumping to functions or methods. Events change the way we design our software and allow us to decouple different parts creating small and reusable classes with a well-defined goal.

The post includes a brief introduction to the Mediator design pattern and how the EventDispatcher implements it. Sample code is included showing how to make a dispatcher, add events and dispatch an event to a waiting listener. There's also a comparison between "event listeners" and "event subscribers", pointing out that the latter has more flexibility when it comes to event priority.

0 comments voice your opinion now!
symfony2 component overview eventdispatcher tutorial

Link: http://blog.servergrove.com/2013/10/23/symfony2-components-overview-eventdispatcher/

Gonzalo Ayuso:
Sending automated emails with PHP, Swiftmailer and Twig
September 24, 2013 @ 11:40:57

Gonzalo Ayuso has posted a new tutorial today showing you how to combine PHP, Swiftmailer and Twig to send automated emails from your application.

My work as host is basically pick the place and encourage people to join to the Coding Dojo. One way of doing this (besides twitter buzz) is take my address book and send one bulk email to all of them inviting to join us. I don't like this kind of mails. They look like spam, so I prefer to send a personalized email. This email has a common part (the place location, the hour, the event description, ...) and the personalized part. I can do it manually, the list isn't so huge, but definitely that's not cool. Because of that I have done a little script to perform this operation.

His example extracts the information from a simple spreadsheet exported as a CSV file. He creates a simple Mailer class that uses Swiftmailer to do the actual sending. You pass in the Twig rendering object (Twig_Environment) that's used to render the email output. He includes a "Spammer" class that uses the Symfony EventDispatcher to send the email if everything works or an error email if something fails. He then drops it all into a Symfony Console command structure, defines several configuration settings in a "config.yml" and makes the script to execute the commands.

0 comments voice your opinion now!
email swiftmailer twig template tutorial symfony console eventdispatcher

Link: http://gonzalo123.com/2013/09/23/sending-automated-emails-with-php-swiftmailer-and-twig


Community Events





Don't see your event here?
Let us know!


symfony library laravel security composer podcast tool opinion language community list interview conference release introduction series voicesoftheelephpant version framework artisanfiles

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework