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

Symfony Blog:
The wait is finally over: the Symfony ElePHPants have arrived!
Nov 06, 2015 @ 12:56:03

The Symfony project has joined the ranks of several other groups in the PHP community and has created their own elePHPant, a Symfony branded version of the plush toy modeled after PHP's elephant mascot.

Conference after conference, we get endless requests from people longing to have their very own ElePHPant. And so, to mark the momentous occasion of Symfony’s 10th birthday we decided to take some serious action. You’ve seen personalised ElePHPants before, but you’ve never seen special edition Symfony ElePHPants!

[...] After having failed to rescue the ElePHPants from Customs, our manufacturers, already extremely busy with their Christmas orders, found a little window to resend us some precious mascots. Although much smaller in numbers than originally planned, we are happy to announce that the Symfony ElePHPants have finally touched down in Paris and are ready in time to celebrate 10 years at SymfonyCon Paris 2015!

You can get your hands on one at the [SymfonyCon Paris 2015 conference] happening next month but that's the only place so far. They're not being sold online (yet) and are available on a first-come, first-served basis at the conference for 20 Euro. If you've been planning to attend the conference, be sure to register now and get in on some great talks (and maybe an elePHPant while you're there).

tagged: symfony elephpant plush project symfonycon paris conference

Link: http://symfony.com/blog/the-wait-is-finally-over-the-symfony-elephpants-have-arrived

Liip Blog:
Symfony: A look back and what it all means
Oct 16, 2015 @ 12:41:36

On the Liip blog they've taken a look back at the impact that the Symfony project (and related projects) have had on the PHP community and ecosystem.

As we were preparing the news about becoming a [Sensiolabs Silver Partner](https://www.liip.ch/en/news/archive/2015/10/15/liip-now-a-sensiolabs-silver-partner.html), I brought back a bit to the history of Symfony here at Liip. We did do a few symfony v1 projects at Liip but things only really took off with Symfony2. Back in 2009 Fabien came to Zurich to discuss some of the Symfony2 components (still PHP 5.2 compatible at the time) he had just released as well as a few he hadn’t yet released. Jordi, who was working at Liip at the time, and I integrated all of them into our company internal framework over the following months which we later presented at the Symfony Live. This means Liip in fact build the [first Symfony2 framework](http://www.slideshare.net/lsmith77/okapi-meet-symfony-symfony-meet-okapi), even before there was the official Symfony framework.

He goes on to talk about the early days of the Symfony community and the work that was done on several bundles outside of the framework itself. He touches on the Symfony ecosystem and its growth during this time and the influence it has had on the PHP community.

All and all I believe that Symfony has really commoditized the concept of a framework for PHP applications. Reusing an existing framework is now the standard when building new PHP applications. Any project that wants to stay alive will in the long run have to refactor on top of a framework.
tagged: liip symfony symfony2 history ecosystem community

Link: https://blog.liip.ch/archive/2015/10/15/symfony-a-look-back-and-what-it-all-means-to-the-php-community.html

Knp University:
Fun with Symfony's Console Component
Oct 06, 2015 @ 10:26:41

In a post to the Knp University blog they show you some of the fun you can have with the Symfony Console component in a single file including a few lesser known (and lesser used) features.

One of the best parts of using Symfony's Console component is all the output control you have to the CLI: colors, tables, progress bars etc. Usually, you create a command to do this. But what you may not know is that you can get to all this goodness in a single, flat PHP file.

They walk you through the creation of a ConsoleOutput object with a simple writeln output of a formatted method. They briefly mention the handling for changing up the output (OutputFormatter and OutputFormatterStyle) before getting into something a bit more complex - table layouts. They end the post with an interesting "hidden" feature inside the component, the Symfony track progress bar (animated gif included to show the end result).

tagged: symfony console component feature pretty output table track progressbar

Link: http://knpuniversity.com/blog/fun-with-symfonys-console

Sylius Blog:
Sending configurable e-mails in Symfony
Oct 05, 2015 @ 11: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

Dalibor Karlović:
Testing your Symfony application on production
Oct 05, 2015 @ 09:14:50

In a new tutorial Dalibor Karlović shows you how to test your Symfony application in production to get a more "real world" picture of how your application is performing for the rest of the world.

The problem here is that you almost cannot guarantee that you can replicate the production environment down to a single detail, it might have a slightly different underlying system, a slightly different network setup, even a different updates applied might mean it works for you, but not on production.

He starts the post by talking about the testing support already built into Symfony and the different parts tested by unit versus functional tests. He gets into some actual (functional) test examples, showing how to evaluate the response from an API request and where the major part of the overhead is - the database interaction. He takes the next step and looks at how to avoid "impure" functional testing and only then starts talking about switching between database types (SQLite vs MySQL) for better performance measurements. Finally, he gets to the topic of the article, running tests in production, and includes a "gotcha" to look out for (hint: don't hard-code IDs).

tagged: test symfony application production functional unit sqlite mysql

Link: https://medium.com/@dkarlovi/testing-your-symfony-application-on-production-a143483768c9

Symfony Blog:
Discontinuing the Symfony Community Translations
Oct 01, 2015 @ 10:49:21

In an effort to reduce some of the complexity and possible differences in the translated versions of its documentation, the Symfony project is removing those from the main website and splitting them into their own sections.

A few days ago, we updated the documentation section on symfony.com to remove the French and Italian community translations. From now on, on this website you will only find the original English documentation.

The main reason behind this decision is that when developers browse the documentation published on symfony.com, they must be sure that the contents are always the right ones. In the case of a translation, this means that all its contents in all branches must always be perfectly synced with the original English version.

The English version sees quite a bit of activity and the translated versions (with a lower contributor count) aren't always in sync. They've split out two of the translations and will now have them coordinated each by their own community leader: French and Italian

tagged: symfony community translation french italian english manager

Link: http://symfony.com/blog/discontinuing-the-symfony-community-translations

Symfony Blog:
How we Auto-Deploy Documentation Pull Requests with Platform.sh
Sep 10, 2015 @ 12:42:38

On the Symfony blog Ryan Weaver shares a "behind the scenes" look at how the project handles and has automated their documentation generation process with the help of the Platform.sh service.

[Symfony's documentation](https://github.com/symfony/symfony-docs) is an open source project with more than 800 contributors. That’s great! But our goal is to always make it easier to contribute and faster to merge in changes. And today, we’ve started doing something really cool to improve our workflow: integration with [Platform.sh](https://platform.sh).

Platform.sh is a hosting solution that provides out-of-the-box continuous deployment for Symfony, Drupal and any other PHP applications. It extends the concept of a Git branch at the infrastructure level. Basically, this means that it’s easy to deploy every branch and/or Pull Request to its own URL.

He talks about the documentation's format (Sphinx) and how, while it does provide flexibility it also can lead to maintenance issues too. Changes can't be seen immediately and it's difficult to review. Instead they worked up a process where each pull request was automatically deployed to its own unique URL. This reduces both issues they were setting around instant feedback and review problems and provides a better experience for the developer overall.

tagged: integration platformsh documentation request pull symfony continuous deployment

Link: http://symfony.com/blog/how-we-auto-deploy-documentation-pull-requests-with-platform-sh

Bernhard Schussek:
Value Objects in Symfony Forms
Sep 10, 2015 @ 11:35:20

Bernhard Schussek has posted a tutorial on his Webmozart.io site talking about the use of value objects in Symfony forms. By nature value objects don't allow the use of "setters" to assign/change values but he shows how to use a custom data mapper to work around the problem.

Many times, Symfony developers wonder how to make a form work with value objects. For example, think of a Money object with two fields $amount and $currency. [...] Can you write a form type for this class without adding the methods setAmount() and setCurrency()? In this post, I will show you how.

He starts with a bit of an overview on what value objects are and how the concept of immutability comes into play. He shows examples of potential issues if setters are allowed to change data and what should be done when a value change is actually needed. He then gets into the heart of the matter, integrating the forms handling with simple value objects. He goes through building a simple form and the use of the empty_data option to create a new value object with the form values. This works fine but breaks down if you need to update an object. Instead he creates a custom data mapper that sets up two methods, mapDataToForms and mapFormsToData, that allow for both interactions to work correctly.

tagged: value object symfony form tutorial custom data mapper emptydata

Link: https://webmozart.io/blog/2015/09/09/value-objects-in-symfony-forms/

Marc Moreram:
EventListeners as Collectors in Symfony
Aug 28, 2015 @ 08:25:07

Marc Moreram has posted a guide on his site to using event listeners as collectors in Symfony 2 based applications. He shows how to hook into the eventing system and both gather events fired (matching your criteria) and view the current collection.

Some of my concerns during the last couple of years have been how to collect data from all installed bundles using available tools in Symfony packages. I say concerns because I don’t really know if is there a tool for that. Some people have told me that the EventDispatcher component can do this work greatly, but then I have the same question once and again… is this component designed for such?

He uses an example of gathering mmoreram.wake_up events from his codebase, triggered when it "wakes up". He shows how to create a simple class for the event with a "rested" value. He modifies this to set up an array of "feelings" inside the event and a method to add new instances to the internal array. Finally he shows how to dispatch an event of the mmoreram.wake_up type and access the resulting set of "feelings" directly from the event.

tagged: event listener collector symfony feelings fire wakeup tutorial

Link: http://mmoreram.com/blog/2015/08/28/eventlisteners-as-collectors-in-symfony/

SitePoint PHP Blog:
From Request to Response: A Journey into Drupal 8 Internals
Aug 18, 2015 @ 10:22:33

In a post on the SitePoint PHP blog author Daniel Sipos takes you on a trip through the Drupal 8 execution structure, from request to response, in the internals of the tool.

In the first article on Drupal 8 module development we looked a bit at the routing aspect of this process. We’ve seen that creating pages with paths is now a matter of declaring routes that match up with controllers. The latter, as we’ve seen, can return a render array that gets interpreted into markup and displayed in the main content area of that page. However, did you know that under the hood, Drupal actually transforms that array into a Response object according to the dictates of Symfony’s HTTPKernelInterface?

In this article, I would like us to go deeper into the internals of Drupal 8 (and Symfony2) and look at what actually happens (and can happen) from the moment a request is made by a user to the one in which they see something returned in response.

He starts at the initial point of the request, the front controller, and talks about the creation of the Request instance and it's handling by the HTTPKernel. He moves into the kernel and talks about the events that are triggered during execution and provides an illustration of the flow of the request all the way through to the response. He then "goes deeper" into looking at render arrays and the HTMLRenderer handling to manage the output of the page on the Drupal side.

tagged: request response drupal8 internals symfony httpkernel overview

Link: http://www.sitepoint.com/from-request-to-response-a-journey-into-drupal-8-internals/