Installing & setting up Symfony 6

  • avatar
  • 821 Views
  • 4 mins read

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.

Prerequisites

  • 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.

Installation

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.

Using Symfony

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

Starting up Symfony web server

To unlock the terminal and stop the execution we can use the Ctrl+C combination on our keyboard.

 Join Our Monthly Newsletter

Get the latest news and popular articles to your inbox every month

We never send SPAM nor unsolicited emails

0 Comments

Leave a Reply

Your email address will not be published.

Replying to the message: View original

Hey visitor! Unlock access to featured articles, remove ads and much more - it's free.