Giving more content power to Sylius with eZ Publish CMS
Antonio is a co-owner of Locastic, and I (Ivo) am a co-owner of Netgen, both web technology companies from Croatia. We have a lot in common, from loving web technologies and living open source to having the same color of our companies' branded T-shirts.
We are proud to announce that we have recently built a website with our Norwegian partner Keyteq who were the project leader. This news wouldn’t be so special if it were not for the fact that the website was built with eZ Publish and Sylius on the same Symfony installation. Netgen’s eZ expertise was enforced with Locastic’s experience with Sylius and the result was open sourced in May.
Besides making it possible to install both systems on the same Symfony instance, we also created a glue in between which offers the creation of products as eZ content objects with a transparent creation of Sylius products in the background. This offers the possibility to manage products as content in the CMS while keeping all the shop features that Sylius offers.
With this combination, all of the sudden, Sylius community gets a powerful CMS option. It might be a bit hard to fully use it because eZ legacy might still be needed, but the legacy free eZ version (called eZ Platform) is around the corner.
A more technical and detailed post had already been published on Netgen’s blog and and a business-oriented post had been published on eZ Systems blog. Here we want to share few additional angles from which you could view this topic.
From the open-source point view, this is a success story - two big open-source products combined on top of a solid framework, producing an optimal solution for the client. Although the solution requires a lot of experience and know-how, this integration does give significant freedom to the client. Any PHP developer can take it over after us - the documentation and the knowledge are out there. Also, the reason we are using these two products is that we didn't want to write a lot of code, we simply wanted to reuse what smarter people had already written :)
From the business point of view, the use case has a lot of potential. There are many great CMS and eCommerce solutions out there, but there are not so many good integrations. Yes, you can use two loosely coupled systems and make them work together, but we would not say that combination is solid. There are always syncing mechanisms involved, data is usually delayed, users are hard to mirror, etc. This works on numerous occasions if the separation is clear:
- products are managed in the commerce solutions
- content in the CMS is not reused in the eCommerce part
- users are usually logged in just one system
Most of these problems could be solved by building one solution with all the features, but that might seem to be too much work. Nevertheless, we found the solution - combining two good products that share the same framework so that the integration could be much deeper.
From the architecture point of view, the conventional integration is about combining different systems via SOAP/REST APIs, importing/exporting via some syncing scripts, etc. In this use case, as already mentioned, we use two systems on top of the same framework instance. This gives us several very interesting options:
- you can reuse a lot of common code. eZ and Sylius depend on many components (not just Symfony) and they are installed in vendor folder via Composer.
- you can instantiate classes or call services of the other system directly.
- you can access the persistent layer directly as all tables are in the same database.
- the database connection is shared - Doctrine
- templating engine is the same - Twig
- front caching is the same - HTTP Cache (with proxy in front)
- installation of all parts is simple, you can see that in our installation notes :)
- the depth of the integration can be decided during the implementation. For example, products could be managed in the CMS or in the shop.
From the Symfony framework point of view, it is significant to see two big products living on the same Symfony instance. The merge was not simple - it required experience in Composer, Symfony, and both products, eZ and Sylius, of course - but it was feasible because the both products used the same parts provided by the framework:
- service container
- DB abstraction
- templating engine
- front caching layer
- user authentication
There are still some challenges to solve:
- currently, authentication works, but the users are not fully integrated so the authorization is not working transparently yet
- support the opposite product automation: if products need to be managed in Sylius interface, make the transparent creation of proxy objects in eZ that will give options to CMS editors to relate/embed/use products in their content.
With Sylius and the upcoming eZ Platform it will be possible to build eCommerce+CMS solutions purely on Symfony stack.
We will do our best to update the main repo, following stable releases of both eZ Publish/eZ Platform and Sylius.
In the meanwhile, check out what we did so far and feel free to give us feedback to make this integration work even better.