Installing & setting up Symfony 6
Symfony is a PHP web application framework and a set of reusable PHP components/libraries. Symfony aims to speed up the creation and maintenance of web applications and to replace repetitive coding tasks. It's also aimed at building robust applications in an enterprise context, and aims to give developers full control over the configuration: from the directory structure to the foreign libraries, almost everything can be customized.
Install PHP 8.1 or higher and these PHP extensions (which are installed and enabled by default in most PHP 8 installations): Ctype, iconv, PCRE, Session, SimpleXML, and Tokenizer; Take a look on how to run PHP8.2 on Ubuntu.
Composer is used to manage Symfony dependencies. Take a look on how to install Composer on your computer.
First you must download and run this installer to create a binary called Symfony:
wget https://get.symfony.com/cli/installer -O - | bash && export PATH="$HOME/.symfony5/bin:$PATH"
Then you can run this command and it will create a new project in new_app folder (in the current location) and install dependencies:
symfony new new_app --version="6.3.*" --webapp
The --webapp option installs all the packages that you usually need to build web applications, so the installation size will be bigger. You can skip it if you are building a microservice, console application or API.
After the application has been created, you may start Symfony's local development server using:
cd new_app && symfony server:start
We will see that our terminal will be blocked by the process and will show us the URL to access the APP from any browser installed on our computer. Usually it will be something similar to http://127.0.0.1:8000
To unlock the terminal and stop the execution we can use the Ctrl+C combination on our keyboard.