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

Joshua Thjissen:
Symfony, Xdebug, and maximum nesting level issues
Nov 18, 2015 @ 10:53:45

In this new post to his site Joshua Thjissen has shared some of his discoveries with Xdebug, Symfony 2 and problems with maximum nesting levels of objects in his testing.

Here you are, developing your code based on the Symfony2 framework. Creating a form here, add a Twig template there, until suddenly, boom! Your site doesn’t work anymore, and all the info you can find in your PHP logs is [an error about the maximum function nesting level being reached.

[...] What just happened? Did I create some kind of recursive function I wasn’t aware of, did somebody commit code that I accidentally pulled? Fortunately for us developers, there is a quick way to deal with this: google it...

According to the information he found via his search it's a common issue and can be "fixed" by bumping up the max_nesting_level to a higher value. He could have stopped there but he wanted to explain why this problem happened, what the nesting is all about, how it relates to the limitations of XDebug and why Twig could cause problems with it.

tagged: symfony2 xdebug maximum nesting level issue stack trace twig

Link: https://www.adayinthelifeof.nl/2015/11/17/symfony-xdebug-and-maximum-nesting-level-issues/

SitePoint PHP Blog:
Basic User Management in Symfony2 with FOSUserBundle
Nov 17, 2015 @ 12:44:05

The SitePoint PHP blog has a tutorial posted looking to help you with managing your application's users via the Symfony2 FOSUserBundle. This bundle provides much of the basic user functionality (creation, login, etc) is a easy-to-drop-in package for your Symfony 2 application.

Symfony has a very powerful authentication and authorization system, which can cater to a lot of our needs out of the box. FOSUserBundle is a library built on top of Symfony’s security system, which provides functionality such as registration, login, password resets, etc. It has built in support for MongoDB, as well as ORMs such as Doctrine, Propel, etc.

The tutorial walks you through the setup of a new Symfony 2 application (living on a Homestead instance) and grabbing the FOSUserBundle code via Composer and pulling into the project. They help you configure the application's security via the security.yml file and create the base user class and matching database table. From there they talk about customizing the templates that come as defaults with the bundle (Twig) and how to handle the email verification of new accounts as well as user logins/forgot password features. The tutorial ends with an example template showing the user's profile information including username, email address and and "edit" link.

tagged: tutorial user management fosuserbundle symfony2 authentication

Link: http://www.sitepoint.com/basic-user-management-in-symfony2-with-fosuserbundle/

Getting Started with Building APIs in Symfony2
Nov 09, 2015 @ 13:44:28

The IntelligentBee.com site has a "quickstart" kind of tutorial for those wanting to use Symfony 2 to build an API-based application. In this tutorial they walk you through a few step process to create the application and a few actions to get the basics working.

Hello all you Interwebs friends! While we’re passing through the shallow mists of time, REST is becoming more and more of a universal standard when building web applications. That said, here’s a very brief tutorial on how to get started with building APIs in Symfony2.

They make use of two other libraries, the FoSUserBundle, JMSSerializerBundle and Doctrine, to handle some of the low level user management and database functionality. They show you how to:

  • Generate a new bundle
  • Set up API versioning
  • Install the FoSUserBundle and JMSSerializerBundle
  • Configure the application's REST interface
  • Set up the routing to get things to the right place

Code is also included to show the creation of "get user" and "get users" actions along with a simple form and "add user" endpoints to allow new users to register. Wrapping the post up, he includes the code for the other pieces of the CRUD operations, the "edit user" and "delete user" methods.

tagged: api symfony2 tutorial introduction rest user management bundle versioning

Link: http://intelligentbee.com/blog/2015/11/03/getting-started-with-building-apis-in-symfony2/

Symfony Blog:
Paving the way for Symfony 3 with the "Deprecation Detector" tool
Oct 22, 2015 @ 10:48:31

On the Symfony blog there's a post talking about a tool they've introduced that is helping to "pave the way" for the upcoming version 3 release of the Symfony framework - the Deprecation Detector tool.

Symfony 3 will be released at the end of November 2015. Learning from our own history, the transition from Symfony 2 to 3 will be much more pleasant than the transition from symfony 1 to 2 that happened in July 2011.

Technically speaking, Symfony 3 includes no new features comparing it with Symfony 2.8, which will be released at the same time. [...] This means that your Symfony applications won't work on Symfony 3 unless you remove all their deprecations. In order to simplify the task of finding which deprecations affect your applications, a new tool called Deprecation Detector has just been released.

The tool runs static analysis against your codebase and finds locations where you're using deprecated methods/classes/interfaces/etc and reports them back for fixing. The post includes the commands you'll need to get the tool installed and how to run it against your code. You can find out more about the project and get details on command line options on its GitHub repository.

tagged: deprecation detector symfony2 symfony3 method interface class service tool tutorial

Link: http://symfony.com/blog/paving-the-way-for-symfony-3-with-the-deprecation-detector-tool

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

Hart KT:
Custom Events in Symfony2 Bundle
Oct 12, 2015 @ 11:10:58

Hari KT has a quick tutorial posted to his site showing you how to use custom events in Symfony bundles from start to finish.

In this tutorial we will create a custom event for symfony2 bundle. Assuming you have downloaded the symfony-standard distribution to play.

He starts by creating a simple bundle (HktEventBundle) and building out the matching event class, extending the base Symfony EventDispatcherEvent. He then shows how to dispatch a simple event from a controller, triggering a html.event.page_viewed event when the request is made to this default controller. He matches this with a listener that subscribes to the event (including a handler method) and the changes you'll need to make to your configuration to wire them all together.

tagged: symfony2 bundle custom event simple tutorial introduction

Link: http://harikt.com/blog/2015/10/11/custom-events-in-symfony2-bundle/

Joshua Thjissen:
Understanding Symfony2 Forms
Sep 14, 2015 @ 09:28:50

Joshua Thjissen has a post on his site that wants to help you understand the basics of Symfony2 forms including how to build them, extend them and the modules they're made up of.

To actually use Symfony2 forms, all you need to do is read some documentation, a few blog posts and you’ll be up and running in a couple of minutes. Understanding Symfony2 forms however, is a whole different ballgame. In order to understand a seemingly simple process of “adding fields to a form”, we must understand a lot of the basic foundation of the Symfony2 Form component. In these blog posts, I’ll try and give some more insights on this foundation.

He starts by explaining the three main steps in the typical form lifecycle: building the form itself, populating and validating data and rendering the form to the waiting user. He then gets into some of the basics of using forms and the types of objects that make them up. He includes examples of creating a simple form, the YAML configuration it compiles to and the functions used to build, render and set options on the form. He finishes up the post looking at form inheritance, extending the form types and where the "ResolvedFormType" comes in to play.

tagged: symfony2 form understand overview types build render validate populate

Link: https://www.adayinthelifeof.nl/2015/09/11/understanding-symfony2-forms/

Joeri Verdeyen:
How I develop in PHP with CoreOS and Docker
Jul 29, 2015 @ 11:41:14

Joeri Verdeyen has posted a tutorial showing you how to use a combination of CoreOS and Docker as a PHP development environment. This is an alternative to the more frequently used Vagrant VM provisioning popular among developers.

I’ve been using the Vagrant provisioned-with-Ansible-setup for a while now. But for the last month(s) I’ve been playing around with things like: Docker, boot2docker, CoreOS, etcd, .. I managed to setup a fast and easy way to develop my PHP applications. Symfony2 is my preferred weapon of choice, so I’ll explain how I’m developing a Symfony2 app.

He starts with the software you'll need installed to get his example up and running, all installable via "brew". He shows how to configure the CoreOS via Vagrant and bring the box up. He then sets up the Docker client to point to the newly created VM as its server. He then creates a docker-compose.yml file to set up the necessary services including nginx, MySQL and (of course) PHP. He then shows the command to run the container, execute the configuration and ensure that all containers are configured correctly. Finally he runs the Composer installation command (Symfony2, remember) and clear the cache.

tagged: coreos docker vagrant development environment tutorial configuration symfony2

Link: https://www.jverdeyen.be/docker/how-php-symfony-coreos-docker/

Symfony Blog:
The Symfony Demo application, three months later
Jul 27, 2015 @ 10:27:02

The Symfony blog has a post that talks about the state of the Symfony "Demo" application three months after its release. The "Demo" application is a simpler way to get an entire Symfony 2 application up and running, giving you a good foundation for either your own development or quick testing.

The [Symfony Demo application](https://github.com/symfony/symfony-demo) was publicly introduced three months ago. In addition to being a learning resource, it's considered the reference implementation of the [Symfony Best Practices](http://symfony.com/doc/current/best_practices/index.html). During the past weeks, we've been busy adding new features to showcase Symfony functionalities. This article is a quick recap of the most important new features.

They talk about four different improvements to the demo setup and configuration process:

  • Full internationalization
  • New console commands
  • New technical requirements checker
  • New JavaScript and Sass/CSS management

They also briefly mention a few other miscellaneous changes at the end of the application around security, debugging helpers and more functional testing.

tagged: symfony demo application improvements symfony2

Link: http://symfony.com/blog/the-symfony-demo-application-three-months-later

Three Devs & A Maybe:
Episode 70 - Composer, Monolog and Symfony2 with Jordi Boggiano
Jul 06, 2015 @ 08:37:24

The Three Devs & A Maybe podcast has posted a new episode (#70) featuring Composer and Jordi Boggiano, the creator and lead developer on the project.

This week we are joined by Jordi Boggiano, Composer (Dependency Manager for PHP) lead and Symfony2 core developer. We begin discussion with how he got into software development, touching on his involvement with Symfony2 before its official release. This topic leads us on to chat about why Composer was developed and how much it has grown in popularity. Jordi then discusses some of the changes he would make if he had the chance, along with what the Toran Proxy is. Finally, we discuss Composer performance and the popular Monolog package that he has developed.

You can listen to this latest episode either through the in-page player or by downloading the mp3 of the show. If you enjoy the episode, be sure to subscribe to their feed or follow them on Twitter to get the info on the latest episodes as they're released.

tagged: threedevsandamaybe podcast ep70 jordiboggiano composer monolog symfony2

Link: http://threedevsandamaybe.com/composer-monolog-and-symfony2-with-jordi-boggiano/