Skip over navigation

Contact us to learn more about OroCommerce's capabilities

learn more

Product News & Updates

Latest Symfony News and Advancements from SymfonyCon 2018

December 21, 2018 | msarandi

Being one of the most popular PHP frameworks in the world, Symfony is also a vibrant community of over 600,000 developers from more than 120 countries. It’s not surprising that each year SymfonyCon continues to grow its audience and has no shortage of exciting news and developments to announce. After all, Symfony is not just a PHP framework – it is also a rich and evolving set of extremely useful tools used by PHP developers on a daily basis. Symfony Flex or Symfony Cloud are just a few recent examples of its modern capabilities. So, this year roughly 1,000 Symfony professionals got together in Lisbon, Portugal to find out all the latest that’s happened to Symfony this year. With the holiday season right around the corner, this event has been a perfectly timed come-together moment for the 2018 Symfony Community. As usual, the Oro team was there, and here is our recap of why everybody loved the event.

Event Details and Speakers

Keynote – Fabien Potencier

The first day of the conference started with a keynote presented by Fabien Potencier, the founder of Blackfire, SensioLabs, and Symfony itself. His topic was the new Symfony Local Server binary and how it helps manage both local environments and deployment to the production servers.

First Fabien briefly compared the states of local web servers with Symfony and explained the reasons behind creating the new tool. He pointed out that the ideal setup should be fast, easy to use, and support remote services, like Docker, but most of all, it should work well with the major platforms, like Linux, MacOs or Windows.

To enable all of that, the new tool offers many features, which are already functional and available to the public. One new feature is the “symfony server:start” command, which allows a developer to start a new local web server that detects the best possible backend. The algorithm first checks whether PHP-FPM can be run. If not, then it fallbacks to PHP-CGI (with the support of FastCGI) and if there is no available configuration, it runs the PHP built-in web server at as last resort. Another highlight of this new tool is the “symfony server:log” command, which can help you tail all the application and server logs with the normalized output.

Finally, Fabien showed us a practical example of how the new Symfony Cloud service, when fully integrated with the Symfony binary, makes deployment, bug-fixing, and debugging routines on the production servers so much easier than ever before. Read more here.

symfony 7

Slides: https://speakerdeck.com/fabpot/symfony-local-web-server-dot-dot-dot-reloaded

Knowing Your State Machines – Tobias Nyholm

Tobias Nyholm took the stage on this one and gave the audience an in-depth presentation on the Workflow component. That was a must-attend talk for the Oro team since we use workflows a lot in our products. A workflow is a sequence of steps or rules applied to a process from its initiation to completion, and this concept is broadly used in a variety of business applications, specifically eCommerce applications.

To his credit, Tobias had a very well-balanced presentation. Before diving into the mechanics of  the Workflow component, he made a solid introduction to its basic concepts, such as graphs, workflows, and state machines. He supported his technical overview with some straightforward real-life examples, like traffic lights or elevator doors, and kept the audience tuned in from start to finish.

Among the most useful guidelines from Tobias were how to define workflows in Symfony via yaml configuration, how to use its events, and how to integrate workflows with the Symfony Security component. His last example referred to a typical eCommerce use case of creating an order and illustrated the related workflow, comprising 4 common states (order created, item added, shipping added and order confirmed) and 3 transitions (add item, add shipping, checkout).

symfony 6

Slides: https://www.slideshare.net/TobiasNyholm/knowing-your-state-machines-symfonycon-lisbon

Using Symfony Forms with Rich Domain Models – Christopher Hertel, Christian Flothmann

During this presentation, the speakers spoke about different ways of integrating rich domain models into the Symfony Form component. To make the presentation more interactive, they also used a simple product CRUD use case.

The first step was to create a standard Symfony form for Product entity and a controller to process the request. At this point we had our product data but no business logic. Then we went on to refactor the Product class to be a Rich Domain Model and integrate it with the form. We started with the easiest solution, which is to create a separate Data Transfer Object (DTO) and map it to the rich model. It worked, but as a drawback we would need to create a DTO class for every single domain model in our solution, making it quite hard to maintain.

Using Symfony DataMappers helps eliminate maintenance issues but it still requires an additional layer of a “glue code”. So, after keeping everyone is suspense, Christopher and Christian finally introduced their new bundle that handles forms with rich domain models without having to write extra code. What a relief!

symfony 5

Slides: https://speakerdeck.com/el_stoffel/using-symfony-forms-with-rich-domain-models-cafc2b0d-2d86-4314-9d8d-d154a26944bf

Building global web apps with multi-region hosting – Jordi Boggiano

Jordi, using two different use cases of two different projects (packagist and teamup.com), was talking about hosting applications with a multi-regional setup. In such applications, having users in multiple locations may affect latency and overall performance of the application. Thus, in order to deliver the best possible UX, the application servers should be located in multiple places around the world. The funny fact is that usually developers and project stakeholders do not suffer from latency – they are often located in one region, usually the same one where the infrastructure sits, which ensures a decent response time for them. Another case for a multi-regional architecture is for supporting redundancy against a regional host failure. In case of any availability problems, there is always an independent server at a different location that can be used instead of a failed master.

So, getting back to the examples from packagist and teamp.com: the requirements for the projects included high reliability, low latency, simplicity, and global support. If we are talking about packagist – could you imagine pushing changes to a repository and pulling back a different state? That would be embarrassing. That’s why Jordi showed us how to tackle this potential issue with the configuration of different replicas hosted across EU, North America, and Asia. Regarding teamup.com, Jordi showed the process of setting up a different configuration, which included terraform + AWS, proxies, and different strategies for GET and POST requests.

Throughout his presentation, the speaker emphasized that going blindly into multi-regional hosting is not a one-size-fits-all solution. Every single use case should be analyzed separately, taking into account the target audience location, requirements for responsiveness, and, of course, an appropriate technology stack.

symfony 4

Slides: http://slides.seld.be/?file=2018-12-06+Building+global+web+apps+with+multi-region+hosting.html

JeoPHPardy (game activity) – Jeremy Mikola

symfony 8

At the end of the first day there was a JeoPHPardy game session for volunteers. We couldn’t miss out on such an opportunity, so one of the Oro developers immediately jumped on the stage.

This year the game was divided into 5 categories:

  1. GarageTrack – different questions about the first day on SymfonyCon2018 (topics, presenters etc.)
  2. PHP 7.3 – the first day of SymfonyCon 2018 was also the release day for PHP 7.3, so this category was about the new features that came with the new release.
  3. Elefonts – guess which font is being represented by elephant drawings, some of which were obvious while the others were super tricky.
  4. Bem-vindo a Lisbon – “Welcome to Lisbon”, featuring questions about this beautiful city, its history, and what it is famous for.
  5. Composer Snippets – guess which project this composer.json comes from, which was a super geeky fun time! Here we got our most favorite question – a blank page. Know the answer? Of course, it’s a composer.json for WordPress!

Some of the questions were quite difficult but, in the end, it was all about having fun, and have fun we did.

Symfony 4 internals – Tobias Nyholm

The second presentation from Tobias Nyholm was about the internals of Symfony 4 but could be just as well called “Internals of Symfony”. The presentation was part of the “Beginner track”, so instead of diving deep into details he gave us a broad overview of the whole process of displaying a requested page in the browser by illustrating specific use cases and explaining how they can be properly addressed.

This way he started from the simple PHP “Hello world” script and then went on by gradually introducing new layers of functionality and refactoring his code to end up with something that he called “Simple Symfony”.

We were genuinely impressed by how he managed to explain the essential basics of Symfony in such a condensed presentation:

  • Controllers
  • Middlewares
  • Cache
  • Container
  • Router
  • Events
  • Security (Voters)
  • Debug toolbar

If you’d like to try building your own framework (just to prove that you can or to understand how most of the frameworks work), you can follow Tobias’ slides (the link below) or another good Symfony article at https://symfony.com/doc/current/create_framework/index.html

Slides: https://www.slideshare.net/TobiasNyholm/symfony4-internals-125268511

What’s a typical Symfony 4.2 application like? – Nicolas Grekas

symfony 3

Nicolas Grekas did a great job explaining the new features of Symfony 4.2 and sharing the best practices of using them.

One of the most useful features is the ability to autowire services by type and name based on already existing autowiring and autoconfiguration. Now developers can define even fewer services manually and rely on the built-in automatically generated configuration instead.

In addition to this new feature, Symfony 4.2 has also improved debugging of autowiring by upgrading a console command debug:autowiring.

Another large feature is the ability to use environment variables to pass external parameters to application configuration. This way developers can define parameters at a lower level (e.g. at the web server configuration) and not expose them directly at the application configuration.

There is also a related improvement for the .env files – now developers can define multiple files with environment variables to have different values based on the environment. For example, some values can be overridden at a local setup or at the specific application environment (dev / test).

Profiling your Symfony application – Michael Cullum

symfony 2

Michael focused on basic topics about performance, why it is so important, why you are supposed to measure it, and when you should care about it.

At the beginning he explained that taking extra care of performance is not always worth the time (i.e. for some backend page used once a month). Sometimes it’s just cheaper/faster to add additional server resources.

Then he focused on the most obvious problems that can cause your application to have poor performance, like:

  • running your application in a dev mode
  • running loads of small queries instead of few bigger ones
  • using any cache
  • not using “-o” switch for “composer install”

After covering the basics he moved on to the demo where he showed how blackfire.io can be used to find problems in your application. Michael added “badly performant” calls to his application (“sleep()” and empty loops) and found those places by profiling the app in blackfire. He also suggested adding a “performance test suite” to your application for performance monitoring.

At the end Michael mentioned other useful tools, such as tideways, datadog, new relic and answered a few questions about them, like which would be the best to use in a particular case.

Links:

https://blackfire.io

https://tideways.com

https://newrelic.com

https://www.datadoghq.com

Symfony’s been only getting better

SymfonyCon Lisbon 2018 was a great experience and we are really glad that we could take part in it. It is such an amazing opportunity to meet the community and to meet the very same people who created the tools that we use every day, to ask questions, and share your own experiences.

As always, the conference wrapped up with the “Year of Symfony” presentation, underscoring the obvious trend that the Symfony community is getting stronger and the framework itself is getting ever more powerful and complete (e.g., Messenger and Workflow components are now available). The next year’s conference city was also revealed, so the Oro team is looking forward to seeing our Symfony fellows and friends there, at SymfonyCon 2019, Amsterdam.

Interested in Symfony and enterprise-grade web application development platform? Check out OroPlatform – the open-source rapid application development platform.

Back to top