Sylius v0.16.0 with new attributes system
Hello Sylius Community!
It has been a while since last release and everyone is probably wondering what's up with the roadmap.
The deadline for the BETA has passed, I promised to release it by the end of 2015, but we simply did not manage to complete everything that is needed for that release. Despite the lack of releases and blog post updates the last few months have been really busy and we have never been closer to the ALPHA and BETA releases.
There are many reasons for the delay and I will elaborate on all of them in a separate blog post which will include the updated roadmap for 2016.
In the meantime, we are happy to release version v0.16.0 of Sylius and its components & bundles.
The new release is exactly 770 commits from 31 contributors. There are several big new features and improvements worth mentioning:
PHP and Symfony Version Bumps
Sylius now requires at least PHP 5.5.9 but we actually recommend running it on the latest PHP7. You can feel the performance boost in all environments. This is really noticeable in the development environment, running the built-in PHP server.
We do not plan to bump PHP version requirement for 1.0, so you can safely assume that Sylius 1.0 will require PHP 5.5.9.
Sylius is now requiring minimum Symfony 2.7.7 and our goal is to use Symfony 2.8 for the stable release. We are constantly fixing deprecations. Thanks Ben!
Travis Running 5954 Steps in 4.5 Minutes
Sylius is developed through TDD with Behat, PHPSpec and PHPUnit. We currently have:
- 559 specs with 3202 examples;
- 517 scenarios with 5954 steps;
- 67 scenarios running via Selenium with 895 steps;
- 16 tests with 35 assertions (We just started using PHPUnit to test API, more info below)
There is plenty of things I'd do differently now (write better scenarios, etc.) but this is still quite an impressive suite. Obviously, it got slow over time. Whole build used to take almost an hour to complete.
Now? Build on PHP7 takes ~7 minutes. Oh yeah, and memory usage went down from few gigs to 40-200mb.
Sylius has plenty of eCommerce features in the main application, but behind scenes there are 36 bundles integrating 29 PHP libraries into Symfony framework. You can imagine that documenting all this requires huge amount of work, but we have made a good first step and updated docs for most of Components. There is still plenty of improvements to do but we have just started!
Have a look around and see if you find these eCommerce libraries useful in your next project, with any framework! Our next step? Bundles!
New Attributes System
Our attributes system was very simple and can be attached to any entity, it does not have to be a Product. In case of Sylius, we use it for products but if you want to add custom attributes to your User, Book, or any other entity, you can do it with ease! Anyway, despite being so flexible in that area, we lacked quite important feature - custom attribute types, we just had few basic types hardcoded and that's it.
Partially inspired by Akeneo's (check them out - awesome PIM) approach we have implemented a much better support of different types. Quick overview:
First of all, every Attribute type is represented by instance of AttributeTypeInterface, which defines the name and storage type of the value. We have several storages available, string, text, date, datetime, integer etc.
Secondly, each attribute type has it's own Twig template and also can have configuration, so there is a lot of flexibility in terms of displaying and validation of values. Sylius already ships with some default attribute types and we will add few more in the upcoming releases. Feel free to contribute or suggest new types!
I had this new system for in mind for a long time and with help of Mateusz Zalewski it finally got into the core!
Codes, Codes Everywhere
Unique identifier other than DB generated IDs is really useful when dealing with API or importing/exporting.
A lot of our recent projects with Sylius have been in a need of an easy way to identify resources and because of that all important core models have a unique
code field that is not editable after creation. This is also very useful in templates, you can easily reference attributes or any other entity.
Ania Walasek made sure you can enjoy working with all Sylius resources!
- #3723 [Taxonomy] Introduce code for Taxon (@tuka217)
- #3692 [Promotion] Introduce code for Promotion (@tuka217)
- #3702 [Archetype] Introduce code for archetype (@tuka217)
- And more...
REST API Testing with ApiTestCase
Sylius is built on top of SyliusResourceBundle. It gives us generic CRUD and format agnostic controllers. It means that basically every controller action in Sylius can render a HTML template, return JSON/XML response or pretty much any other format you configure. That's why we quite easily got a full REST API.
Unfortunately, it was working pretty much out of the box with only YAML configuration, so we have not covered it with tests properly. Now we are going through all endpoints the TDD way, defining what type of request do we want to send and what are expected responses.
And you know what? ApiTestCase works with every Symfony 2.3+ & 3.0 application!
- #3701 [API] Initial API tests (@lchrusciel)
We have changed the configuration tree structure and introduced concept of
Factory services for all resources.
sylius_taxation: validation_groups: tax_category: [sylius, app] classes: tax_category: model: AppBundle\Entity\TaxCategory form: AppBundle\Form\Type\TaxCategoryType
sylius_taxation: resources: tax_category: classes: model: AppBundle\Entity\TaxCategory form: default: AppBundle\Form\Type\TaxCategoryType validation_groups: default: [sylius, app]
This properly separates the responsibility of creating new resource objects and allowed us to fix several issues, including #480.
I have also reworked the logic behind registering entities/documents as Sylius resources and now we have a single
DriverInterface that is solely responsible for registering a resource.
This change removed a lot of code and magic happening in all bundle extensions and unified the way in which resources are configured.
I added a generic routing generator for all resources and it will give you proper configuration in few lines of YAML. You can read more in the documentation.
- #3776 Implement routing generator for Sylius resources (@pjedrzejewski)
- #3617 [Resource] Created InMemoryRepository and implemented ResourceInterface (@NeverResponse)
- #3721 Rework SyliusResourceBundle drivers (@pjedrzejewski, @TheMadeleine)
- #3480 [Taxonomy] [RFC] Constructor for the Taxonomy model (@TheMadeleine)
Other Notable CHANGELOG Entries
- #3342 [Product] Implement Toggleable interface on Product (@TheMadeleine)
- #3783 [Product] added original price (@starspire)
- #3755 [Product] added availableTo parameter (@starspire)
- #3586 [Shipping] Remove class Claculator, all calculators implement CalculatorInterface (@tuka217)
- #3079 [TRANSLATION]Payment method translation (@paullla)
- #3740 Remove web installer and clean up InstallerBundle (@pjedrzejewski)
- Most of fluent interfaces have been removed (except for query and form builders) Why?
- #3731 Remove configuration form validation groups (@pjedrzejewski)
Things coming in v0.17.x
We have over 130 PRs waiting for merge and they will go in to the core very soon, some PRs worth having a look for future versions:
- #3762 [WIP] New ResourceController
- #3778 [WIP] Merge Translation into Resource + some clean ups
- #3646 [POC] UiBundle and AdminBundle
- #3854 [WIP] Repository clean up and TranslatableResourceRepository deletion
- #3831 [WIP][ResourceBundle] Clean up ResourceBundle forms
- #3771 [RFC][Order] Introduce OrderItemUnit
- #3350 [Metadata] Complete component & bundle integrated with Sylius Core
- #2844 [ThemeBundle] Theme bundle
- #3696 [Addressing] Removed Address relations and introduced CodeAwareInterface
- #3300 [WIP] [Review] SyliusReviewBundle
- #3165 [WIP][Association] Associated products
You can install and try the latest Sylius by running the following commands:
$ composer create-project sylius/sylius-standard my_project $ cd my_project $ app/console sylius:install $ app/console server:run
If you want to help us in making Sylius 1.0 great eCommerce solution for all developers, join our amazing community and start contributing ideas and code!
We have reached another great milestone, packages have been downloaded over 1,500,000 times and I still remember celebrating 1M not so long time ago. I strongly believe this is just the beginning...
Expect the blog post with roadmap and vision update in the coming weeks! Thank you to the whole Community for your hard work, activity on GitHub amazes me every day.