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

Sylius Blog:
Sending configurable e-mails in Symfony
Oct 05, 2015 @ 16:15:46

In a post to the Sylius blog Mateusz Zalewski shows you how to create configurable emails in your Symfony-based application with help from a custom bundle they've released to help make it a much simpler process.

Every developer, during their adventure with PHP programming has been struggling with sending emails in a web application. However using PHP send() function is often insufficient for common web applications, when you need templates, variables, configurations etc.Fortunately, Sylius provides SyliusMailerBundle and Mailer component, with some awesome features. [...] Of course, this bundle and component are fully decoupled and can be used in any Symfony application.

They walk you through the installation (via Composer) and configuration of the bundle, adding it's dependencies to the kernel of your application. He shows how to configure the container with connection information (like the name and from values) and update your database with the tool's migrations. From there he shows how to customize your emails, making use of the Twig template handling to define the body contents. The bundle also makes it possible to define custom email types with different settings for each. Finally they show how to send the emails, grabbing the sender information and sending the email, either more manually or via a custom defined email type.

tagged: symfony email configurable tutorial bundle customize template sender

Link: http://sylius.org/blog/sending-configurable-e-mails-in-symfony

Scott Mattocks:
C is for Configurable
Nov 30, 2012 @ 15:12:21

Scott Mattocks has posted the next in his "LUCID development" series of posts with the next letter in the acronym, "C" for Configurable:

As code moves through the software development process, it moves through different environments. In many cases, the full details of then environment may not even be known at the time development starts. Getting your code to change its behavior on the fly is only possible if you have carefully and thoughtfully interleaved configuration parameters into your code.

He talks about handling configuration for external systems and the responsibility that comes with access to the connection information for resources. He makes some recommendations as to where to start if you're looking for places in your code to change how configuration options are used - low hanging fruit like code that accesses external systems.

Other parts of this LUCID series so far are: L (Logging) and U (Unit tests).

tagged: lucid development principles configurable

Link:


Trending Topics: