Nicolas Grekas Talks About Symfony Development, Code Profiling and the Future of Symfony Framework

by Shahroze Nawaz  March 17, 2017

We are extremely delighted to have Nicolas Grekas for this interview. Nicolas is a core contributor to Symfony,and the CTO of Blackfire.io, a popular performance management tool. Nicolas is an influential PHP developer and speaker. In addition to development, he loves to speak at PHP conferences and help budding developers kickstart their software projects.

In this Interview he talks about his role at Sensiolabs and how frameworks are better than plain vanilla PHP code.   

Nicolas Grekas interview

Let’s start the interview

Cloudways: Hello Nicolas, thank you for taking out time for this interview. What motivated you to become such an exceptional PHP developer?

Nicolas: PHP is a humble platform. Its marketing doesn’t make abstract promises about the way the language is (well or not) designed. Instead, it says it solves real world problems. That’s exactly how I started doing PHP: getting some things done. Then I learned the edge cases of the platform. PHP is full of special behaviors. But all of them are hackable in some ways. I found myself quite motivated by trying to overcome the challenges that were in my way. That’s how I learned PHP up to where I know it today. From resiliency by coding against obscure behaviors (e.g. Symfony’s Debug component), up to programmatic code rewriting for the extreme cases, there is always a solution – the language is rarely the limit (the runtime is, thought.)

Cloudways: You are a core contributor to Symfony. How is Symfony evolving with PHP 7.x, particularly Symfony 3.1 and 3.2. What are your favourite features in Symfony?

Nicolas: I am one of the most active code contributor these days, but my contribs are only a small part of what Symfony really is. There are so many great minds that shaped it and are still shaping the framework. Symfony is really a collective piece of work.

Even after 10 years, Symfony is doing exceptionally great for me. PHP 7.0 gave a boost to the ecosystem, and Symfony benefits directly from it. We now have code that is designed to take full advantage of low-level v7.x features, like OPcache’s static-arrays-in-shared-memory to name the most important one.

I worked on the new PSR6-compliant “Cache” component for 3.1, then we enhanced it to handle tags in 3.2, and PSR16 in 3.3. In 3.2, we added support for environment variables in the (compiled) dependency injection container. Mix that with better offline cache warm-ups, and Symfony is now a really good fit for containerized applications.

Cloudways: Mentors play a vital role in career development. Who were your mentors in the PHP world. Who would you recommend to follow within the PHP community, especially Symfony?

Nicolas: I studied Physic and Chemistry in a French “High School” (ESPCI Paris). I owe a lot to this scientific background, which gave me some core principles that shaped my mind. I think of the teachers as my mentors. Those Professors who made me understand a few bits of what is entropy, statistical mechanics, some maths around waves propagation, etc.

In the PHP world, I came quite late to work as part of a community. I’m doing Symfony for more than 3 years. I have to thank the phpBB 2 team, because that’s the first PHP app that I tried hacking 15 years ago, and I learned a lot doing so.

I’m only at the beginning of my journey of meeting amazing peoples from all PHP communities: Symfony, phpBB, Composer, Doctrine, Drupal to name a few. However, to me, the lone developer is often the exceptional one. Working with the community reminds me everyday that there will always be someone that won’t have the same priorities as yours and will make you deal with some edge-for-the-lazy-you-but-not-for-them cases you didn’t consider well enough. Cultural diversity is key.

Related: Adam Wathan Talks About Test Driven Laravel and Podcasting

Cloudways: Are frameworks more beneficial than vanilla PHP. How Symfony helps developers kickstart their projects and write robust code?

Nicolas: Your app > its framework > components > vanilla PHP. That’s the typical layered architecture of most apps. Symfony sits both at the framework level and at the components level. The components level is at its core. Should people leverage them? There’s no doubt about it! Each component has received countless hours, dedicated attention and special care by people skilled in various domains. Thus, it is important that you do not waste time and efforts on problems that have already been solved.

For instance, take the Routing component. It’s been there since the beginning and has received lots of attention from top level developer. Still, its next version (3.3) will ship with significant performance improvements for large routing tables. The component is free to use. It’s not only about money or cleverness, but more importantly about keeping the focus on your business problems.

At the framework level, Symfony helps developers kickstart their projects by providing the scaffolding required to bootstrap each component, so that you can leverage them to build your next killer app. Stay tuned to this topic, as we’re working on Symfony 4, due by the end of this year 🙂

Cloudways: Request handling and performance are two major issues in application development. How blackfire.io works and help boost the performance of PHP applications?

Nicolas: Part of my work at SensioLabs is helping as CTO of Blackfire.io. At its core, Blackfire uses a PHP extension, which we call the “probe”, that gathers raw performance and quality metrics about any running PHP script (time, memory, calls, important arguments, SQL/HTTP queries, etc.) On top of that, we built a toolset that integrates into the dev workflow and provides on-demand security access, recommendations, tests, data visualization (either manual or automated), dev or prod, etc.

I also use Blackfire as a regular user, to profile my code. We all expect our code to behave in some manner – we even write unit tests about that. But a profiler shows you the plain truth. And this can be quite surprising. I learned that the first working and even tested version of some patch may still not behave as I’d like it to behave, especially in complex apps.

Blackfire is a game-changer here because it makes profiling so easy that nobody should claim they don’t have time/know how to do so anymore. Can you imagine a surgeon doing its job without some kind of medical imagining? That’s how I feel about profiling.

Cloudways: Nicolas, now my favorite question about the workflows of developers. How do you manage your workflows when working on multiple development projects. What tools and services you use in your development workflows?

Nicolas: On the hardware side, I use a nice Fujitsu laptop, with two additional screens (that’s three screens with my laptop’s, but I mostly use two of them.) On the software side, I use Ubuntu, git, VIM, a terminal and a browser. Sometimes qgit, Sublime Text, a Windows VM to debug issues there (yes, Blackfire works also on Windows!) or use PowerPoint. I may be wrong but I tend to think that the slowest part of my development experience is my brain, so I don’t feel the need for a fancy IDE. For this reason, and because it allows me to switch easily from one host to another, I mostly use vanilla settings for my software stack.

When working on PHP projects, I do “cd ~/Code/orga/project” (same layout as used on GitHub), then use Composer, and the embedded php server (“php -S” or the Symfony “bin/console server:run” wrapper.) Docker/Docker Compose for booting the Blackfire stack locally, and more recently the soon to be publicly released SensioCloud, to reduce infra setup to a simple port tunneling.

On the project/quality management side, we use Github, Splitsh, Jenkins, Appveyor, Zendesk, Jira, Slack, and a few others.

Cloudways: Symfony has seen a surge in both usage and popularity after Symfony 3.x release. In fact, Symfony recently reached the 500 millions download milestone. What are the reasons behind this sudden rise in popularity?

Nicolas: As far as I know, no other project have this fantastic ability to drop code like Symfony does. We learned how to do so while preparing version 3.0. And now it’s a vital part of the project. Add the arrival of PHP 7.0 and you have all the reasons that make Symfony fresh for me again.

We call that the “deprecation policy”. It requires us to write backward-compatibility layers for each code we’d like to drop in the next major version. That plays well with semantic versioning and our BC-policy promise. But that’s the boring side. The exciting side is that this allows us to warmly welcome better ways of doing things, instead of the usual

we can’t do that because, you know, history…”.

It allows us to just drop entire features or components so that we can keep the effort concentrated on relevant ones.

To me, this plasticity is the key part that unleashed the 3.x release cycle and that will ensure that Symfony will keep growing and stay relevant for years to come.

Related: Manuel Lemos of PHPClasses Talks About His Passion for PHPClasses and the Good Parts of PHP 7.1

Cloudways: Several PHP frameworks use Symfony components such as HttpKernel, DomCrawler, CssSelector. What are your views on this cross-framework usage of Symfony components?

Nicolas: The more the better! The huge benefit is the cultural diversity that comes with each new projects adopting Symfony at their core (for instance, Drupal and Laravel use Symfony in ways that the Symfony community did not and could not anticipate). That makes the project stronger, and thus benefits each projects in turn. This virtuous circle is the reason why Symfony can claim to provide high quality reusable standalone components. And that’s also the reason why I’d encourage people all around to cherry-pick their set of Symfony components to build the next iteration of their projects (whether open source or not).

Cloudways: Enough technical questions! Let’s talk about how you spend your free time? How do you guys enjoy at Sensiolabs? Could you please share some pictures of the excitement?

Nicolas: I’m quite involved in the graduates community of my former engineering school, as VP of its Alumni association. I go running from time to time, cinema, good food in Paris, spend time with friends, see my family, and of course enjoy every seconds that I can share with my lovely wife.

Did I tell you I’m French, but also Greek by my father? That allows me to spend a few weeks per years in Greece, see my grandmother, and benefit from the sea and sun. Not bad 🙂

Working at SensioLabs means being close to a community project, which means participate to at least two conferences per year. That’s quite motivating! Here is a picture of the team taken at SymfonyCon Berlin 2016. Can you spot where Fabien is?

SensioLabs Team

Cloudways: Images of the senior developers’ workstations greatly inspire budding developers. Please share an image of your workstation.


Nicolas Grekas Workplace

Cloudways: What do you think of managed hosting solutions like Cloudways, that provide an optimized PHP stack with features to help developers kickstart their Symfony applications? We would love it if you could test the Cloudways Platform and give us your valuable feedback.

Nicolas: Managed hosting solutions provide great value. They allow devs to focus on their core issue: solving business problems. I can’t wait until infrastructure as a code is really ready for the masses.

Start Creating Web Apps on Managed Cloud Servers Now!

Easy Web App Deployment for Agencies, Developers and E-Commerce Industry

About Shahroze Nawaz

Shahroze is a PHP Community Manager at Cloudways - A Managed PHP Hosting Platform. He’s always in search of new frameworks and methods to implement them. Besides his coding life, he loves movies and playing soccer with friends. You can email him at shahroze.nawaz@cloudways.com

Stay Connected:

You Might Also Like...