Soon after the Internet became a mass medium, many systems developed in order to seize new opportunities. E-commerce grew rapidly and many realized that there are business opportunities related to selling and buying online. Web shop systems followed that lead. Today there are numerous systems for web shop development as well as many companies that have decided to implement webshops.
In this article I will talk about Sylius, which is becoming more and more popular. It is based on the Symfony2 framework, which is one of the most popular PHP frameworks and each day more and more developers use it to develop both large and small web applications. Certainly, the migration of eZ Publish and Drupal to Symfony2 framework has contributed to this trend and the quality of Symfony2 framework.
What is Sylius?
Sylius is a modern e-commerce platform based on Symfony2 framework, and as an open source project, announced under MIT license, it is therefore completely free for downloading and implementing any changes. It is developed using BDD and TDD methodology – the only ecommerce solution implemented using this methodology at the moment. It is characterized by a simple and clear architecture as well as maximal flexibility. Even though it has not reached its beta phase yet, developers are already using it for implementing complex and custom webshops.
Sylius is a new player among existing open source ecommerce systems, such as Magento, osCommerce and PrestaShop. Sylius is still not in beta release and yet is already well-known within the Symfony2 community. Developers are using it for producing ecommerce solutions with high levels of customization. What is very exciting is that you can participate in making such a great software as Sylius since the whole project is produced by community. The community decides and discusses about every major decision and everybody can participate if they want. How do you participate? It is very easy – you just need to have a GitHub account and a little bit of time and knowledge about Symfony2 framework and you can start. You can participate with adding translations or just with reporting bugs, or you can just spread the word about Sylius.
As mentioned earlier, Sylius is an open source project, started by Paweł Jędrzejewski in 2011. The idea of commercializing the product existed at one point (KNPLabs company), but Pawel gave up on the idea because he thought that the community deserves transparency regarding the project that they are contributing to. Also, he said he feels that toxicity and politics can not contribute to the project in a positive way. His final decision was to keep developing Sylius in the community that created it, maintaining the complete transparency.
Paweł Jędrzejewski started the Sylius standalone application seven months ago, embracing StoryBDD with Behat. Since then the community has managed to develop a relatively big set of features and achieve a very extensible architecture. Currently, after finalizing the repositories organization on GitHub, the priority is to fill the feature holes in the checkout and API.
- Product Management: unlimited products, complex products with options and attributes, product variations
- Inventory tracking: real time tracking, products available on demand, tracking of individual units
- Complete taxation support: works with simple and complex tax rules, rates for different tax categories and zones, tax included in price support, customizable tax calculators
- Product categories: tree structure, complex taxonomies, list your products by category, brand, producer (and so on), create featured product easily
- Shipping engine: organize and track your shipments, unlimited number of shipping methods and individual shipment units, track shipments, statuses, and individual shipment units, multiple flexible shipping charge calculators
- Easy to host: Syliys requirements are identical to Symfony2 requirements, small setups run on cheap hosting, easy to deploy with capifony (capifony setup file comes with Sylius standard installation)
- Free now and always: fully open source, business friendly licence – MIT; no paid edition with more features
Sylius was recently upgraded to the LTS Symfony version 2.3. (LTS = long term support for three years for any bugs and four years for any security issue). Sylius architecture is based on several decoupled components. At this moment, the standard version is made of 19 different bundles: AddressingBundle, CartBundle, CoreBundle, FlowBundle, InstallerBundle, MoneyBundle, OmnipayBundle, PaymentsBundle, ProductBundle, PromotionsBundle, ResourcesBundle, SalesBundle, ShippingBundle, TaxationBundle, TaxonomiesBundle, VariableProductBundle, and WebBundle. Symfony also uses some well known Symfony2 bundles as: FOSUserBundle, FOSRestBundle, KnpMenuBundle and PagerFantaBundle.
The idea behind Sylius is to construct your own solution using the components, the same philosophy as Symfony2. All features are also available as standalone bundles.
Sylius is completely component-based, so shop tasks such as payment, shipping, taxation, taxonomy (and so on) are non-mandatory installs and not have to necessarily have to come from Sylius itself. You can write custom bundles, or you can use any other existing bundle. Thus, it introduces the idea of the Symfony2 framework early on, which has been integrated, in this case, as a full stack.
After you have installed Sylius on your server, you can do the complete customization through override and customize your own interface. It is easy to customize core models and adapt the logic inside any service. Also, it is possible to use any of the 1900 Symfony2 bundles in your Sylius project.
A part of the customization process is overriding the Twig templates in order to customize your shop. Twig is a modern template engine for the PHP programming language. It compiles templates to optimized PHP code and the overhead compared to regular PHP code was reduced to the minimum. Also, Twig has a sandbox mode to evaluate untrusted template code, which allows Twig to be used as a template language for applications where users may modify the template design. Twig is powered by a flexible lexer and parser. This allows the developer to define its own custom tags and filters, and create its own DSL. You can find out more about Twig on the official page [Editor’s note: There’s also a tutorial on Twig elsewhere in this issue].
Despite this separation of concerns, functionality like model persistence or CRUD actions is common for all bundles. Initially, every model had its own controller, or even 2 controllers, one for backend and another for frontend. Additionally, there was 1 manager and 1 manipulator class per entity, which resulted in a tremendous amount of duplicated code in every bundle. To reduce tons of duplicated code in controllers for basic CRUD actions, Sylius uses SyliusResourceBundle, and it is the most important bundle in the entire application. SyliusResourceBundle has allowed for removing manager and manipulator classes, frontend and backend controllers for every entity, getting rid of very simple actions just to modify the sorting or filtering and making controllers format agnostic (API). You can use SyliusResourceBundle as standalone component for any Symfony2 project.
When using Sylius, Behaviour Driven Development (BDD) via Behat is already provided. Also, there is a demo that shows you the basic functions of Sylius.
The project’s current version is 0.1.0. Anyone who is interested in undertaking the project, can install it via Composer quite simply (listing 1). Issues that may occur when using Sylius are brought together on GitHub. Also, you might want to follow Sylius on Twitter.
During installation you can chose to load fixtures that insert some dummy data into your database so you can test Sylius‘ basic functions. The demo application includes features like registration, profile administration, product listing, product listing by taxonomy and taxon, shopping cart, checkout process without payment integration and full backend administration to work with your Sylius store.
curl -sS https://getcomposer.org/installer | php composer create-project-s sylius dev / sylius cd sylius php app/console sylius:install
The major challenge is implementing/integrating a payment system, since the main application does not have any payment integration available out of the box. The idea is to have a payment system as flexible as other Sylius engines.
Pawel Jędrzejewski, who started Sylius, has started implementing a gateway-agnostic solution and will share a POC soon. This should allow to integrate any payment API library into Sylius and hopefully there will be many integrations in the core. While this feature is not implemented there is options for using some of existing Symfony2 bundles like JMSPaymentCoreBundle (Apache 2.0 licensed, this bundle is not maintained very actively, and it also requires using concrete data models – but it is an an interesting option anyway) or Omnipay. An integration bundle for the Omnipay library has already been created and it seems to work well with Sylius. However, the library itself has some architectural issues and involves a lot of BC breaks. Therefore, one must be careful when evaluating this option, but it seems promising. Payum at first glance looks like the most complex option. It seems to be regularly updated and the author has already approached the community on GitHub. It certainly seems like a promising option.
In the latest major Sylius update, Cart and Order models have been merged. By doing this, the checkout-related logic has been dramatically simplified. It is important to make sure that templates are displaying the data properly in the cart summary and the calculation logic and events are already in place. If a user has selected the shipping method, it should be displayed or it should even be possible to allow it to be changed in the cart form.
Tax is recalculated on every cart change. However, there is a case when the cart has changed and the user has already picked the payment/shipping options, and the system must be able to handle it. At the moment this is done by event or hand calling the method for recalculating taxes. Also there is no option for adding and calculating taxes for delivery costs.
Sylius does not have proper notification/confirmation e-mails integrated out of the box. At this moment, people have to listen to events and use their own mailers. An e-mail notification system is definitely a must-have thing for any ecommerce solution.
All Sylius controllers work on top of the FOSRestBundle and those who need the API can access it relatively easily. Some work was started on routing configuration (in a separate branch), but configuration of serialization mappings and using one of HATEOAS bundles in needed. Currently the FSCHateoasBundle is used to handle the serialization of Pagerfanta (the paginator) instances. This bundle is more powerful and a more complete integration and usage ought to be considered. Another option is the BazingaHateoasBundle, a much younger solution which integrates a standalone library into Symfony2. It seems to have all the features we need, but both solutions should be considered in order to pick the best one.
Redesign, documentation and translations
Sylius‘ founder, Pawel Jędrzejewski, stated that he is planning on redesigning the Sylius default theme with the same person who was in charge of creating the new look of the Sylius website. A discussion on the look is leading among the community in RFC on GitHub about redesigning that Pawel started few weeks ago. The starting idea is responsive Bootstrap3 with a nice look. Sometimes in the future, redesigning the administration panel might be in the spotlight, depending on time and resources. In one of the RFCs AngularJS was proposed as a possible solution for the backend and there were some talks about one page web app for backend with a great UX. We will see what community decide in future.
It is very important to focus on the documentation, and as mentioned earlier it is not very friendly for beginners. Also, though the bundles docs are looking rather good, the main application has almost no guides at all. Good documentation is very important for a stable release. A few documentation hackdays are also considered.
Sylius has already been translated into numerous languages, but most of the translations are incomplete. The process used for translating right now is not the best possible, and I am already exploring different approaches. An optimal way for resolving this issue should be found.
Feature freeze & beta
After the above points are finalized, a feature freeze will happen. This depends on the contributions of the community. After the feature freeze, the plan is to focus on stabilization and fixing bugs. A beta release will ideally happen in December 2013, before the first SymfonyCon in Warsaw. It is hard to tell how long it will take to move from the beta to the version 1.0.0. but hopefully not too long.
Sylius is built on solid foundations (Symfony2 as the enterprise-class PHP framework). It is 100% open source project, with a high quality and component-based approach. It is agile and developer-friendly, and the best thing is that you can override every single part of Syilus in accordance with your project’s requirements. Sylius has a promising future with great community behind the project and importantly is continuously developed and improved.
However, at the moment, Sylius is not an ideal solution. It has lack of sophisticated user managament (CRM) and it is not an out-of-the box solution. There are numerous bugs and there is no notification system. Also, lack of documentation is an issue, Sylius does not support signing in with social networks and payment integration as well as templating solution and promotions with coupons are not yet implemented. Furthermore, it is not for non-developers and does not have a simple GUI installation. Simply put, Sylius is still an ecommerce framework, not yet software like Magento.
Sylius‘ popularity as well as quality is undoubtedly growing, which comes as no surprise if we consider its advantages. As with any other project that is still in its early stages, Sylius has some disadvantages and flaws, but I am sure that they will be eliminated sometimes in the near future. Certainly, developers will continue to develop web shops for their clients using this particular platform, especially Symfony2 developers.
Antonio Perić-Mažar is CEO at locastic, agency specialized in web and mobile development and UI/UX. He has more then 6 years of experience with developing custom web applications and last few years he is using Symfony2 as everyday tool. At locastic he is responsible for the web applications development, business development and relationships with customers. In his spare time, he is trying to finish his PhD in Computer Science.