A Little Sylius Adventure

For over 7 years I have mostly worked on e-commerce projects. Most of them were Magento 1 & 2 projects with a few adventures with other solutions (Drupal commerce 😱). I never truly enjoyed developing on any of the e-commerce projects. There were some challenges that were fun, but most of the time the challenge has been to make the framework/cms do something it was not meant to do, it was most often about workarounds and not creating a new nice maintainable code.

So when beginning of this summer I was given the opportunity to work on a Sylius project that didn’t sell products, but subscriptions I jumped on the occasion. I wanted to work on a Sylius project for a while now and this project was different from any I had worked on before. I knew that with the budget & time we had it would have been impossible to do the project using Magento. Therefore it would be interesting to really see how flexible Sylius can be.

Now that the website has been running for a while I can say, yes Sylius is flexible. And it mostly comes down to how simple everything is.

Symfony under the hood

Sylius uses Symfony, so we get all the flexibility the Symfony framework offers.

Wish to create a new entity? make:entity and let the command line guide you.

Wish to make permissions and complex rules, make:voter and again let yourself be guided. Even changing the behaviour of the permissions in the Back office it’s just a breeze. And that is even though permissions are a “Plus Edition” feature and we are using the open-source version. Our permissions are actually quite different than what the Plus version offers, we have permission on actions, but also on individual data. Some admins for example can see only some orders. All this is made possible with little code because of how simple the underlying system is.

Want to change the checkout? Well, it’s twig templates and Symfony forms. Modifying the steps will require an additional 30 minutes of reading documentation about State Machines, but that’s it. Things were built to be changed.

Running Symfony with doctrine make most of the most repetitive task extremely easy and fast. On top of that, the Symfony debug toolbar is constantly there, showing you how many queries are running on a page, which voter was used and any other debug information you might need.

Having Symfony also means we have access to all the Symfony bundles out there. Need 2FA authentification? There is a bundle for that. You can install and make it work with Sylius with ease as long as you understand bundles are not like WordPress plugins; they require the developer to plug the things together in yaml files.

Sylius is good

When you are out of the Symfony world look more into doing things in sylius, it remains mostly simple.

Need to store your files on a bucket on not on local file storage? You just need to configure the file abstraction layer. So no need for old school NFS mounts on the server that might fail and start creating strange behaviours. Sylius can connect to pretty much any storage solution.

Need to use an asynchronous queue? With Magento, you are obliged to use RabbitMq; which is not straightforward to have with Azure or Aws. Sylius? you can use your MySQL database if your queue is small or you can use the proprietary solution of both hosting solutions. That’s again thanks to the proper abstraction layer, which means it’s only some configuration to use pretty much any solution.

Sylius is also fast; without any page cache or query cache, our website is running without a sweat with an average response time of 150ms. And we still have a few quick-win optimisations. With Magento, it’s impossible to achieve this kind of load time without the page cache. Page caching is an important tool in a developers arsenal, but it must not be there to hide underlying issues as it does with Magento.

The bad

As with all solutions, Sylius is not perfect.

Most native entities & also the backend controllers use a ResourceController. In my opinion, this controller has way too much logic in it. So if you need to change a certain behaviour so very slightly you end up rewriting entire functions. Even adding additional parameters to the twig rendering is not always possible.

I don’t like much creating new views in the admin, it requires a lot of repetitive yml declaration. I think most of it could have been simplified.

Some of the critics of Sylius are the lack of features out of the box. But I think that is actually a good thing. It’s part of why it’s so easy to customize. There are community modules that allow adding some of those features.

One feature I would have really liked to see is a configuration module. Most contributions in Sylius is done on individual entities. Need to have a new way for users to pay? well, you will create a new Payment and select the provider you wish and configure it for each country. This makes sense. It also adds flexibility.

This also has its limitation, we needed to have for each country a few dozen texts to be configurable; add DataLayer ids and other configurations. All these would need to be stored on the “channel” entity. The page to edit the entity becomes quite messy very quickly. Some of these configurations you might argue could be a parameter in a yaml file, but in most cases, we are not masters of these data and they change more than they should.

This is why the used my ComfyBundle which allows us to have configurations per channel & language. We should soon make public the bundle that allowed us to integrate this bundle to Sylius and have a backend interface to make the configurations.

Conclusion

I think Sylius is a really good Commerce solution. Like everything it’s not for everybody; we can still make cheaper websites with Magento, and even cheaper ones with SASS solutions. But I believe that with the right budget a Sylius website will be a better one as it will compromise less.

Magento does offer more features but those features are harder to alter, and some of them are either bugged or not conceived properly.

Personally, I enjoyed a lot my experience with Sylius. It was a challenging project with complex features & a very tight timeframe. The existing code in Sylius was rarely of a hindrance, we rarely had to implement workarounds that made no sense and were untestable.

I would definitively recommend Sylius for future projects; it has a growing community and it improves at each iteration.

--

--

--

Passionate web developer. Symfony lover. Writing as a hobby. Sad Magento 2 developer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Microservice Architecture

Automatic Tweet Liker using Tweepy and Django - Part 2

All About CEH Practical/Experience

Demystifying Corda Serialisation Format

Writing Code: an Art Form

UE4: Tree-cutting system breakdown

Software Engineer Job Search Resources

A Pragmatic Programmer Paranoia

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Oliver de Cramer

Oliver de Cramer

Passionate web developer. Symfony lover. Writing as a hobby. Sad Magento 2 developer

More from Medium

A simple PHP framework (6/?) Templating

The 3 Stages to Making Your Own No-Code Solution | HackerNoon

Beginner level TDD: the Prime Factors kata

table_open_cache