Installation¶
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.
Before installation¶
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.
Project setup¶
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.
Tip
We are about to release a new major version of Sylius, which is going to be 2.0. Worry not, upgrading from 1.x to 2.x will be possible. It is currently recommended to start with 1.x and upgrade the project once 2.0 is there, but if you’d like to start playing around with the still-in-progress version, you can use this command to set the environment on Sylius 2.0-BETA.X.
composer create-project --stability=dev sylius/sylius-standard:2.0.x-dev MyFirstShop
Note
Are you familiar with Docker? Check out the Sylius Installation Guide with Docker
Warning
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).
Warning
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.
Launching application¶
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.