Symfony is the leading PHP framework to create websites and web apps
There are many PHP frameworks but in this post, you will learn how to install Symfony. Maybe this is one of the most advanced ones out there.
Symfony is an entire web development platform that includes a framework
On the other hand, it uses the Model – View – Controller pattern that is so widespread among developers. Also, it allows you to create from simple websites to macro projects and complex applications all hand in hand with a huge community of users.
So, let’s get started.
Install Symfony on Ubuntu 21.04
Symfony can be installed via composer or from your installer which is the easiest and most feasible option.
So, open the terminal and upgrade Ubuntu 21.04
$ sudo apt update && sudo apt upgrade
Symfony is a PHP framework, so it requires PHP to work. If you already have a LAMP or LEMP server you do not need this step.
sudo apt install php php-json php8.0 php-curl php-mbstring php-xml php-zip php-tokenizer php-tokenizer libpcre3 --no-install-recommends
In addition to install GIT,unzip and for a successful installation
$ sudo apt install git zip unzip
Download and install the symfony-cli tool
$ wget https://get.symfony.com/cli/installer -O - | bash
After that, add the Symfony installation path to the PATH user.
$ export PATH="$HOME/.symfony/bin:$PATH".
And apply the changes by running
$ source ~/.bashrc
With this, we will be able to use the tool from any location of the prompt.
Now configure the email and user of your user in Git.
git config --global user.email "[email protected]" git config --global user.name "Qadry"
Now you can create a new project by running it.
symfony new example --full
Note: You have to replace example with the name of your project.
Such as :
$ symfony new UnixcopProject --full
And now you can start working with your text editor like Visual Studio Code.
To start the local webserver you can run:
cd UnixcopProject symfony server:start
Remember to replace example with the name of your project.
Now you can go to http://localhost:8000 and check your project.
Now you know how to install this framework on Ubuntu 21.04 this is the first step to start developing applications with this great framework.