Keen on learning new eCommerce technologies?
Subscribe to our newsletter
and be up to date!
This is the first of the series of guest posts we would like to share with you on our blog. We have an amazing Community of active Sylius users who can describe the power of our technology in live cases. Our product’s decoupled architecture allows for not only standard eCommerce implementations but also provides a framework for various Symfony projects based on Sylius standalone components.
So, for starters – read about “Monofony” – Symfony starter developed by Loïc Frémont!
This article assumes that you already have Sylius knowledge. To learn more, read the docs.
Used to start projects from scratch and add all dependencies step by step? If yes, you probably spend a lot of time setting everything up.
Within this starter, you have a pretty similar development environment to Sylius, but without the e-commerce part.
This project has a branch “example/managing-articles” as an example for all usages of this starter. All examples in this blog post can also be found in this branch.
Monofony also contains basic features like customer login, customer registration, forgotten password, user’s profile, customers and administrators management…
You can fork the whole project starter on github or just copy parts of it.
Monofony was called “Polyfony” at first. It was a Symfony starter for all projects in my company Mobizel when I joined it in 2015.
My co-worker Laurent Bay discovered this amazing e-commerce framework on Symfony years ago (around 2014). He started to use it for an e-commerce project when Sylius was in the pre-alpha development phase. He was very enthusiastic about it and even made some contributions.
Enjoying so much the ResourceBundle, we started to include it in all of our Symfony projects.
During this period, I forked our project starter and wrote only one bundle following best practices of Symfony in this period and re-called this project “Monofony” cause it has one “Mono Bundle”.
With our Sylius experience during developments and contributions, we added some Sylius features step by step in our projects.
We added the User Bundle to handle users and customers (it was in Sylius/UserBundle at the beginning).
At December 2016, I tried the Grid Bundle in a project and started to use it on our Symfony starter. Coupling it with the Ui Bundle (which is part of Sylius stack now), you can have an awesome administration.
In order to share this Symfony starter with ex-coworkers, I have moved it to a public repository to GitHub.
It’s now an open-source project with MIT license (same as Sylius). But it’s only the beginning and you can contribute to improve this starter!
With Monofony/SymfonyStarter, you can use the Behaviour-Driven-Development methodology with:
It contains a copy of the Sylius Travis configuration but you can easily switch to another CI.
Monofony validates composer file, phpspec, behat, infection etc…
Like Sylius, it has a docs folder which contains the first step to build your whole project documentation. It uses sphinx-doc and the Sylius theme.
If you have contributed to Sylius documentation, you’ll enjoy this part.
You can follow installation on its readme.
To manage an entity with Sylius/ResourceBundle, you just have to:
Let’s configure an article entity as an example.
You now have to add it on Sylius Resource configuration.
You can learn more from Sylius Resource Bundle documentation.
To have an administration like this, you just have to configure a new grid and configure its routes.
So, let’s configure “Article” grid!
You can learn more about configuring a grid in Sylius documentation.
To configure backend routes for your entity, you have to create a new file on backend routes folder.
Let’s configure our “Article” routes as an example.
And add it on backend routes configuration.
And that’s all!
You can learn more about configuring routes in Sylius documentation.
As an example of a project started with Monofony, let me introduce the Jedisjeux project.
It’s a French website about board games. It uses more Sylius bundles than Monofony, such as product bundle (a board game is a product resource). This project is also open-source and you can explore its source code on GitHub. Just have a look at its composer file to see the impressive list of Sylius bundles it uses.
If you like this article and you are also working on some Sylius-based project, contact us! We will be glad to share any article about live use cases of Sylius bundles in your Symfony apps.
Subscribe to our newsletter
and be up to date!