This post is written by Ivo Lukač, co-founder and board member at Netgen, which has 10 years’ experience working with eZ to build complex websites. Ivo is an eZ Publish CMS specialist and will be at SymfonyLive London 2015 as one of the event’s community partners. Find out more about our community partners and the conference on the SymfonyLive London website.
Symfony is a powerful framework. This has been proven many times over, but Netgen and Locastic took on the challenge of combining of combining two big Symfony-based projects on top of one Symfony instance.
For those of you who don't know, eZ Publish is an open source PHP-based CMS first version dating back to 1999 and its second big overhaul is nearing completion. Besides refactoring a lot of features, it was also ported to Symfony full stack. The current stable version is 5.4, a hybrid system with new and legacy kernel provided together. At the end of this year, version 6, better known as eZ Platform, will be released with only the new kernel and no legacy code by default.
Sylius eCommerce is a much younger product, but has gained a lot of popularity within the Symfony community over the last two years, and could be claimed as the top Symfony-based eCommerce option available at the moment. It is also shipped as a full stack Symfony app, but most of the features are decoupled into separate bundles and could be used on their own. Locastic became involved with Sylius at its early stage and already has several shops built and in production.
Last year we had our first chance to integrate eZ Publish and Sylius. The project proved to be difficult. Most of the problems were caused by integrating the implementation with an old ERP. Merging eZ and Sylius was not simple, but we managed to do it to a degree that proved enough for the particular project. Later on we cleaned it up and opened the code on GitHub so that others can try it, use it, and contribute in return.
The current version of the integration uses the latest stable eZ Publish community version (2014.11) with all Sylius bundles (from version 0.14) installed via Composer and configured to make it work together with eZ. One additional bundle implements an eZ Publish field type which encapsulates creation, editing, and removing Sylius products inside eZ objects. It's very simple to work with both eZ Publish and Sylius APIs, thanks to the Symfony service container. Twig makes it possible to have Sylius-based pages (like the basket) with the same header and footer as other eZ-based pages and it works like a charm. Even the URLs are synchronised so the Sylius slug is replaced with the eZ generated one when products are shown in the eZ context. The user authentication works and remains separate.
The next logical step is to integrate both systems at the user level as well so that authentication works transparently across both systems. Such integration will provide further possibilities, such as merging the admin interface into one. The recently released 0.15 version of Sylius has some changes in the user management, which will help this integration.
What this project proves is that it is possible to combine two bigger products into one Symfony instance. The basis for this is, of course, Composer, but there is much more to it. The Symfony service container, as well as the Symfony routing and security components, also played a large role in the integration.
We are eager to see if the community will use this integration for their own CMS and eCommerce projects and we would love to hear your feedback. Your first chance is at SymfonyLive London where we will be holding a community stand on eZ and Sylius as one the community partners of the conference. See you there!