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

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/

Semaphore Software Blog:
Getting Started with Symfony 2
May 11, 2015 @ 10:35:57

The Semaphore Software blog has posted a new tutorial for those wanting to get into the Symfony2 framework and find out what it's all about. In this new tutorial they walk you through some of the basics of the framework and shows you how to get a basic first site up and running.

Symfony 2 has seemingly gained the attention of developers in recent times. Owing to the growing hype surrounding this framework, it is something that you ought to know about. A web application framework formed of reusable PHP components has been termed as Symfony. Symfony 2 is an updated version of this framework, and it enables developers to create websites and web applications with ease and convenience. The individual PHP components that set out to form this framework can be selected as per your design and development requirements. Let’s understand why Symfony is gaining popularity and why it should be used by you.

They start with the download and installation of the current version and where to place the resulting files. They briefly cover each of the main directories in the framework setup including a bit of sample code to illustrate. They then get into the bundling system and how it fits it with the overall ecosystem of your application, diving it up into functional "chunks". They show you how to register, configure and extend a bundle with some of your own functionality. Finally, the tutorial shows how to configure the database connection and run Doctrine to generate the table mappings.

tagged: gettingstarted introduction symfony2 beginner walkthrough

Link: http://blog.semaphore-software.com/getting-started-symfony-2.html

SitePoint PHP Blog:
Symfony2 Registration and Login
May 11, 2015 @ 09:55:57

The SitePoint PHP blog continues their series looking at authentication and authorization in a Symfony2 application with part two of their series. This time author Taylor Ren focuses on the registration and login systems for your users.

In part 1, we discussed the basics of setting up a security system in our app (database and security.yml settings). We also covered the pre-registration stage where a user verifies their invitation status with the app. In this article, we will talk about registration, logins and post-login actions.

He starts with the registration side of things, showing how to create a simple form asking for a username, password (and confirming it), a homepage URL and email address. He shows how to link it to a User instance and render the form out to a Twig template. Once the request is submitted the user is created, including encoding (bcrypt) of the password. Next up is the login form that's linked to the "AuthenticationSuccessHandler" for post-success handling. The tutorial finishes off with a piece of code showing how to redirect the user back to their requested URL once authenticated.

tagged: symfony2 series part2 authentication register login tutorial

Link: http://www.sitepoint.com/symfony2-registration-login/

Marc Morera:
Lazy Commands in Symfony
May 08, 2015 @ 08:13:22

In the latest post to his site Marc Morera about the use of "lazy services" with Symfony2. In his examples, he uses a command line application to illustrate his point, but it could apply elsewhere as well.

Since Symfony version 2.4 you can define your controllers and commands as services. This is so useful as long as you need to treat your classes as much decoupled as possible. [...] When we define as lazy a service, this is not instanced when is injected, but only when is accessed. [...] The point here is to define our service intended to work with the model as lazy.

He shows how to implement this kind of "lazy" handling in a command, registering the commands into the services but not creating the instances of them until they're used. He includes some example code showing how this is set up and offers a few tips on the implementation and common issues to think about.

tagged: symfony2 command lazy service register tutorial

Link: http://mmoreram.com/blog/2015/05/08/lazy-commands-in-symfony/

SitePoint PHP Blog:
Symfony2 Pre-registration and Invite System
May 07, 2015 @ 08:25:48

The SitePoint PHP blog has kicked off a new series of posts today with part one of a set of tutorials showing you how to create a registration and invitation system with Symfony2. While they've talked about general Symfony2 development before, this series will focus more on the security side, on authentication and authorization.

In this article series of two parts, we are going to talk about a very important area of web application development: Authentication and Authorization. Symfony2 has a very detailed elaboration of these two topics in its official documentation. Anyone who is seriously looking into this is encouraged to read through that official document after absorbing the essentials from this tutorial.

The author starts with a brief list of common user management tasks including registration via a form, sending confirmation emails and verifying the user's login. He helps you create the underlying "user" table (complete with the SQL) and talks a bit about the contents of a few of the columns. He includes the settings you'll need to put into your "security.yml" configuration file and a bit of detail on what each section and its settings mean. He then moves on to the "User" entity and class file, adding some functionality to the standard generated class. He also includes the code needed to create the invite and registration actions.

tagged: registration invite system symfony2 tutorial user management authentication authorization

Link: http://www.sitepoint.com/symfony2-pre-registration-invite-system/

Marc Morera:
Visithor, Testing Your Routes Without Pain
May 05, 2015 @ 09:25:55

In his latest post Marc Morera shares a new tool he's created to help with testing routes for specific HTTP code responses and other attributes of your "HTTP layer" - Visithor.

Many years ago I was thinking about a simple and fast tool to test specific routes, expecting specific HTTP codes and providing an easy environment of ensuring properly your HTTP layer. So... I present you Visithor, a PHP based library that provides you this functionality, with a simple configuration definition and a very easy way of installation.

He starts with a few quick commands to get the library installed (either globally or local to the project) and how to create the first configuration file. This file defines the tests to execute as a set of URLs with allowed HTTP response codes. He also shares a Symfony2 bundle that can be used to integrate it with your current application, allowing for more flexibility in route check configuration and environment settings. He also includes a quick example of integrating it with your Travis-CI build as a "script" command to be executed.

tagged: visithor library testing http response code symfony2 bundle integration

Link: http://mmoreram.com/blog/2015/05/04/visithor/

Vincent Composieux:
Run a Symfony application using Docker and docker-compose (English)
Apr 30, 2015 @ 10:53:48

Vincent Composieux has put together a new tutorial showing you how to get a Symfony2 application up and running inside of a Docker virtual machine for development and testing.

Why boot a full virtual machine when you can only run Docker containers of what you need to develop your Symfony applications ? This is one question asked by Jeremy Derusse at his "Docker dans le développement l'intégration continue" talk during Symfony Live Paris 2015. Those slides are really interesting, I invite you to take a look. They demonstrate the power of Docker and docker-compose but are waiting for practice in order to well understand. So I enjoyed a rainy week-end for further study!

He then outlines the components needed for a simple Symfony2 application: Nginx, PHP (well, PHP-FPM), MySQL and, of course, the code for the application. He includes the full contents for the "docker-compose.yml" configuration file to generate this Docker instance. He walks through each of the components it requires and talks about what they contain and how to define each of them as an image. Following this, he creates the containers with a "docker build" and brings it all up and working with one "docker up" command. He also includes a few other helpful commands for getting memory/CPU usage as well as removing all containers and images with a single command.

tagged: symfony2 application docker tutorial dockercompose nginx mysql phpfpm

Link: http://vincent.composieux.fr/article/run-a-symfony-application-using-docker-and-docker-compose

Symfony Blog:
New in Symfony 2.7
Apr 28, 2015 @ 10:13:14

The Symfony blog has been posted spotlights in several of the improvements in the 2.7 release of the framework over on their blog. Each of them describes the changes and includes some sample code showing the new feature in action:

Keep an eye on the Symfony blog for more of these component spotlights and improvements as they're released.

tagged: symfony blog new feature symfony2 version release component

Link: http://symfony.com/blog/

SitePoint PHP Blog:
StackPHP Explained
Apr 23, 2015 @ 11:40:02

The SitePoint PHP blog has a tutorial posted today that wants to help you understand StackPHP, the project centered around middleware, specifically related to the Symfony2 HttpKernelInterface.

Today we are going to look at StackPHP and try to understand what this thing is all about. Although this post will have some code, this article will be rather theoretical as we are interested in learning what StackPHP actually is, where it comes from and why it is useful. As the front page of the StackPHP project says, Stack is a convention for composing HttpKernelInterface middlewares. But, in order to actually understand this definition, we will have to cover a few concepts first. At the end, we will also illustrate the concepts we learned in the context of StackPHP with some example code.

They start with a brief look at the HttpKernelInterface and how it works with the overall request and response flow of a typical application request. From there they describe the Decorator design pattern that will be used to augment the request/response objects as they're going through the middleware process. Following this they look at how StackPHP fits into this picture and provides a few code examples showing both basic and a bit more complex middleware handling (including the use of StackBuilder).

tagged: stackphp tutorial middleware httpkernelinterface symfony2 introduction

Link: http://www.sitepoint.com/stackphp-explained/