SymfonyCon Lisbon summary

Les-Tilleuls.coop
7 min readDec 12, 2018

--

Find the original version of this article here.

As every year, is beginning the SymfonyCon! Let’s review the highlights of this huge conference.

We started this huge conference with Fabien Potencier’s keynote.

So first question asked, what are your dev server environment? The state is that every one of these are difficult to maintain and you want a fast and convenient way to develop and deploy. When you are using your PHP built-in server there is only one connection at a time, no HTTP2, no SSL, etc. Well a new Symfony binary is now available. It’s coming along with the SymfonyCloud platform offer and has no dependency (even PHP). It comes with a lot of new shortcuts to test in a local environment. It now uses php-fpm when available otherwise fastcgi , http2, http/2 Push HTTP Preload and works with any PHP project. It manages multiple versions of PHP, because usually you have multiple versions on your computer. It is fully integrated with Symfony Cloud. The expectation is, if you can manage to make your project work in your local environment, you should be able to make it running in your hosted environment without any other ops configuration.

Here are some console commands:

  • symfony local:php:listallows you to find which versions of PHP you can use. If you want to change, just set a .php-version file in your project root directory containing the version you want to use. You can create a php.ini file on your project root directory if you want to specify some configuration only for your current project.
  • symfony server:log to tail your logs. They are parsed and converted into json. This way you can have something way cleaner on your console. If your project is using TLS (and if not it should) you should have it in your development environment.
  • symfony ca:install creates for you a certificate for localhost / 127.0.0.1 / …, registers it in Firefox for you. You’ll be able to find them in ~/.symfony/certs. So from now on you’ve got HTTPS in no time.
  • symfony proxy:start is meant to help you if you are running with specific domain names, subdomains names. It works with the next command.
  • symfony proxy:domain:attach example.com --dir=/some/dir by default it’s supporting .wip tld. You can run with symfony run different commands in the server. Add -d and you have it in background.
  • symfony env:create some-bug opens a branch in local.
  • symfony open:remote copies your production env in a new url.
  • symfony log allows you to check your logs and Symfony debug allows you to switch in dev mode.
  • symfony tunnel:open allows you to work locally with your debug environment database freshly created.

Tobias Nyholm is replacing Michelle Sanver to talk about graphs

Unfortunately we could not attend to Michelle’s talk about workflow in e-commerce websites. Anyhow, Tobias has showed us once again the almighty power of graphs and that you can always think of a workflow for your actions. We can assist at an already seen but always nice to hear talk of how the workflow component works and how you can leverage its power in the best ways. Definitely a component you should take a look at if you did not already.

Next speaker I’ve seen is Samuel Rozé with the Messenger Component

Samuel already did some talks about Messenger in the past. The first one was 6 months ago. What happened in 6 months? Well, the real troubles start when your Open Source project is released and used in real projects, and mostly when it is used on any other project than yours. In 6 months new needs emerged and a lot of new possibilities were added in the meantime. Ok, now, what is the Messenger component about? If you want to add some structure separation in your code. Let’s say cqs pattern or hexagonal pattern, you definitely need a way to let your different domains to be able to speak to each other. But you don’t want to have any strong bounds between them. Messenger is the kind of component you would use. Whether you use a monolithic application or a micro-services based application does not matter. It has been designed to be used with different services and even with some message queues (rabbitmq, kaf, etc). I strongly recommend you to give it a try !

The first speaker in the afternoon is Nicole Cordes and will present static php analyses tools.

If you want to improve drastically your code base, its quality, its maintainability and avoid some basics mistakes, there are some tools for you. Nicole is giving us a full tour. The first one is PHPSTAN. This tool is able to analyse your code and detect according to different levels of configuration the flaws in your code, starting from bad methods or variable usages and declarations to bad architectural designs. Second one is PHPMD. This one allows you to analyse your code structure and extract some measurements. Third one is Code Climate, to grab for you the number of lines of codes and it’s complexity. Although I would recommend using PHP Metrics, which is in my opinion more complete. One cool thing of code climate is that it has some integration with most of CI systems. Next one is SonarCloud. If it happens that you already know Sonar Cube this one is the saas version. It allows you to find flaws in your code complexity. I would add myself some names to this, as for example php-cs-fixer, and symfony security checker.

Jordy Borgiano is bringing to us his experience about servers availability.

Developers and technical teams usually don’t feel any side effect concerning latency or availability. Indeed you often work on a private environment which is not reached by thousand of persons, because sometimes (usually?) they use servers in the same geographical region. Their customers in the other hand can be disappointed when it comes to crossing an ocean. The solution can be to scale up you architecture but you should do it with some minimal intelligence, for instance you can start using a CDN which can serve your data from different regions.

First iteration

The use of Terraform with AWS + Redis sessions. The architecture is simply one primary region which is used for write, and read were handled by replicas. But it was quite slow.

Second Iteration

Came with the idea of proxying the write requests from the local replica to primary region session forwarded in HTTP headers. Client IP forwarding using proxy headers in HTTPS and VPC peering for security. Of course with signed request/response. Finally a failover to replica processing if proxying fails. Problem is the proxies had to create a new connection every time. Which were slowing down the process, but creating connection pooling is a workaround. Downsides are that network sometime fails random requests, as well with AWS ELB which somehow times out on random requests. Session size is limited in headers, and if the primary is down, it only leaves you read-only capabilities. With this solution you could achieve 99,5% availability with a TTFB of 120ms. To achieve a 100% (is it possible?) you could think of having a multi master postgres/mysql network.

Nice to see some real use cases of multi-region architecture.

Next topic is API Platform with Antoine Bluchet

This time it’s not Kévin Dunglas who is talking about api-platform but Antoine. You might already know api-platform, maybe you even used it on a project. But here Antoine is demonstrating that you can leverage a lot of Symfony component into api-platform. For instance the Workflow component or the Messenger component. With the help of Symfony 4 and recipes, you have almost nothing to do. Everything is pre-configured, you only need to tweak the configuration to fit your needs. After seeing a demonstration of a pizza delivery system with these two components, the thing to have in mind is: do not get stuck only with a solution when you can combine them.

It’s now time to talk about Webpack Encore

Ryan Weaver is the creator of Encore. This tool combines the best of two worlds, meaning you can now use your favorite Javascript framework with Symfony. The component lets you define a webpack configuration in no time. Ryan gave us the best practices, such as making your CSS a dependency of your app, making each component independent and creating one entry that is included in your layout per component. Definitely a great tool!

Last talk I’ve seen is one from Kévin Dunglas about Mercure

Mercure is a protocol allowing to push data updates to web browsers and other HTTP clients leveraging the strength of HTTP2, (which websocket can’t and won’t do), bringing to you a secure and fast multiplexed pub/sub system. Kévin did a demonstration through a application available at symfonycon.les-tilleuls.coop which is a joined-in clone where you can comment and rate talks during a conference and interact by pushing smiley buttons. These buttons would trigger an animation that you can see on every screen subscribed to the mercure hub. A tool to keep an eye on!

See you on next conference!

Originally published at gregoirehebert.github.io on December 12, 2018.

--

--

Les-Tilleuls.coop

French self-managed worker cooperative. Creators of @ApiPlatform and Symfony contributors. PHP, Javascript & eCommerce consultants and web developers.