So you want to try creating an online shop with Sylius? Great! The first step is the most important one, so let’s start with the Sylius project installation via Composer. We will be using the latest stable version of Sylius.
There are some prerequisites that your local environment should fulfill before installation (not many of them).
For more details, take a look at this chapter in The Book.
The easiest way to install Sylius on your local machine is to use the following command:
composer create-project sylius/sylius-standard MyFirstShop
It will create a
MyFirstShop directory with a brand new Sylius application inside.
Are you familiar with Docker? Check out the Sylius Installation Guide with Docker
Beware! The next step includes the database setup. It will set your database credentials
(username, password, and database name) in the file with environment variables (
.env is the most basic one).
Specific Sylius versions may support various Symfony versions. To make sure the correct Symfony version will be installed (Symfony 6.0 for example) use:
composer config extra.symfony.require "^6.0" composer update
Otherwise, you may face the problem of having Symfony components of the wrong version installed.
To launch a Sylius application initial data has to be set up: an administrator account and base locale. Run the Sylius installation command to do that.
cd MyFirstShop bin/console sylius:install
This command will do several things for you - the first two steps are checking if your environment fulfills technical requirements, and setting the project database. You will also be asked if you want to have default fixtures loaded into your database - let’s say “No” to that, we will configure the store manually. You will be also asked if you want to generate API Tokens.
It’s essential to put some attention to the 3rd installation step. There you configure your default administrator account, which will be later used to access Sylius admin panel.
To derive joy from Sylius SemanticUI-based views, you should use
yarn to load our assets.
yarn install yarn build
That’s it! You’re ready to launch your empty Sylius-based web store.
For the testing reasons, the fastest way to start the application is using Symfony binary. It can be downloaded from here. Let’s also start browsing the application from the Admin panel.
symfony serve open http://127.0.0.1:8000/admin
Great! You are closer to the final goal. Let’s configure your application a little bit, to make it usable by some future customers.