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

Symfony Finland:
Porting a Symfony 3 application to Flex
Jun 26, 2017 @ 11:42:12

On the Symfony Finland site they've posted a retrospective about moving an application from Symfony 3 to Flex including the work that was done in the switch and the performance of the result.

Earlier this year I did some experimenting with a Hybrid state object between Symfony Twig templates and front end JavaScript frameworks. Since that time I did that experiment, the Symfony Flex project has progressed. I thought I would try how to port the state prototype to Symfony Flex.

[...] In my case the application was rather simple and all built in the AppBundle, which is best-practise in Symfony3 for many applications. I mostly had to move files and configurations around and change namespaces.

He starts by spending some time talking about the difference between a Symfony 3 environment and the environment Flex provides. He then goes through the eight or so steps to move from one to the other including file/directory changes and configuration updates. Next comes the look at performance differences between the two. Unsurprisingly Flex came out on top in every measurement he threw at it.

In addition to the new structure, the apparent improvement in performance is obviously welcome. This would likely be even more evident where I could leave more dependencies out, for example in API workloads. This obviously won't magically push Symfony/PHP into Golang or Node.js territory for raw API throughput, but for existing large code bases it could provide a low-effort boost.
tagged: symfony symfony3 symfonyflex migration performance benchmark process tutorial

Link: https://symfony.fi/entry/porting-a-symfony-3-application-to-flex

CloudWays Blog:
How To Add ReCAPTCHA To Symfony 3 Forms
Oct 05, 2016 @ 12:19:31

The Cloudways blog has a tutorial posted helping you add CAPTCHA functionality of your Symfony 3 form handling. In this case they're adding the Google reCAPTCHA handling to a registration form for users of your system.

Websites use different techniques and methods to validate contact, login and user registration forms. Some opt for custom validation methods while a large majority deploy third-party validation techniques.

Google provides a well known and proven validation tool known as reCAPTCHA. In this tutorial, I will demonstrate how to add Google reCAPTCHA to a Symfony 3 registration form. Hence, if you’re looking for a Recaptcha Symfony union, you’ve got it!

They start by helping you set up a Cloudways PHP application and install the latest version of the Symfony 3 framework on it as a sample application. They then walk you through the steps required to create a reCAPTCHA application and hooking it into your Cloudways server's hostname. With that set up they move over into the Symfony application, generating the User entity via Doctrine and creating the matching view/controller to handle the reCAPTCHA output. The registration form is then created and the handling is added to verify the CAPTCHA value submitted against the Google servers.

tagged: cloudways recaptcha symfony3 form registration tutorial google

Link: https://www.cloudways.com/blog/add-recaptcha-to-symfony-3-forms/

Symfony Finland:
Symfony2 turns five, Symfony 3.2 continues the momentum
Jul 25, 2016 @ 10:24:50

On the Symfony Finland site they have a post that's celebrating the 5th birthday of Symfony2 and mentions that the latest version, Symfony 3.2, is continuing the legacy and trends the Symfony 2.x releases started.

Late in 2015 the Symfony project as a whole celebrated it's tenth anniversary. Another significant milestone is reached in July 2016 as Symfony2, the second major iteration celebrates it's fifth anniversary. Five years is a long time in IT, but even more so in web development.

[...] Symfony2 was a major rewrite that turned the previous monolithic framework into PHP components as well as a framework to tie these into a coherent framework for developers to build their applications on. Since that Symfony3 was released and was more of an evolutionary release.

He looks back at Symfony2 in hindsight and features/functionality it brought to the table that made major impacts in the PHP ecosystem. This includes things like heavy use of dependency injection, bundles and a standardized interface on HTTP requests and responses. He ends the post looking at some of the new features that are coming with Symfony 3.2, listing out several links back to Symfony's own blog posts with more details on each.

tagged: symfony2 symfony3 birthday momentum features advancements

Link: https://www.symfony.fi/entry/symfony2-turns-five-symfony-3-2-continues-the-momentum

Jeremy Curny:
Symfony 3 - REST API
Apr 04, 2016 @ 13:19:26

In this post to his site Jeremy Curny briefly walks you through the creation of a REST API using the Symfony 3 framework and several components/bundles to add in common functionality.

He includes the commands and dependencies you'll need to get the system set up:

  • Initialize the project
  • Install dependencies (including the FosRestBundle, JMSSerializerBundle and NelmioCorsBundle bundles)
  • Register bundles
  • Configure bundles
  • Making the first route

He ends with the command to run the built-in web server and be able to test out the result. The simple action he's created can then be called using a GET request on the default/index route with a 200 OK response with "hello world" content.

tagged: symfony3 symfony framework tutorial rest api project

Link: http://jeremycurny.com/2016/03/27/symfony3-rest-api/

Symfony Blog:
New in Symfony 3.0
Mar 16, 2016 @ 09:39:21

On the Symfony blog there's a new post briefly looking at Symfony 3 and what's different about it as compared to previous releases (and what's not).

Symfony 3.0.0 was released on November 2015 as planned by the Symfony 3 roadmap. As we do with any new Symfony version, we should publish a blog series explaining its new features.

However, Symfony 3.0 is a very special version which contains no new features comparing it with Symfony 2.8. Their only difference is that 3.0 removed any feature marked as deprecated in 2.8. That's why we won't publish any "New in Symfony 3.0" post. Instead, let's do a quick recap of the new Symfony 2.8 features which are also available on Symfony 3.0.

Among the items on their list are things like:

  • New components like Guard Authentication and LDAP
  • A MicroKernel component
  • Improvements for VarDumper, Console and the Security components

Each of the changes on their list include links to get more information about the component and the post wraps up with a quick "how-to" on upgrading to Symfony 3 from other releases.

tagged: symfony symfony3 update release component change deprecation

Link: http://symfony.com/blog/new-in-symfony-3-0

SitePoint PHP Blog:
Easier Authentication with Guard in Symfony 3
Dec 22, 2015 @ 09:49:03

The SitePoint PHP blog has posted a new tutorial from author Daniel Sipos showing the Symfony framework users out there how to do easier authentication with Guard, a newer component introduced to the framework to take some of the complexity out of the process.

The Symfony2 security system is a complex part of the framework, one that is difficult to understand and work with for many people. It is very powerful and flexible, however not the most straightforward.

[...] With the release of version 2.8 (and the much awaited version 3), a new component was accepted into the Symfony framework: Guard. The purpose of this component is to integrate with the security system and provide a very easy way for creating custom authentications. It exposes a single interface, whose methods take you from the beginning to the end of the authentication chain: logical and all grouped together.

He starts off with the configuration changes you'll need to add/make to use the Guard component, defining an "in memory" admin user type. He shows how to define the firewall to use a Guard form authenticator and update the security configuration with the path matches and related roles. He then gets into the controller side of things, defining a loginAction and a simple username/password form in the matching view. Finally, he updates the services configuration for the authenticator and creates the full FormAuthenticator class to go along with it. He then explains each piece of this puzzle and how it all works together to make the authentication happen.

tagged: authentication guard symfony3 tutorial easy introduction security

Link: http://www.sitepoint.com/easier-authentication-with-guard-in-symfony-3/

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