Search

Symfony's Articles

Symfony is fast and leading PHP framework built on top of the Symfony Components. Drupal, phpBB, and eZ Publish frameworks also built on Symfony Components.

Create and Setup Symfony Project
Symfony is fast and leading PHP framework built on top of the Symfony Components. Drupal, phpBB, and eZ Publish frameworks also built on Symfony Components. In this article, we will go through how to create new Symfony framework using composer command. We will also setup Symfony application and connect with MySQL database. Requirement Before creating your first Symfony application you must have installed: 1. PHP 7.2.5 or higher version with extensions. 2. Composer, which is used to install PHP packages. Create Symfony application Run the below composer command to create new symfony application. composer create-project symfony/website-skeleton my_project Now go to the project folder cd my_project/ If you need to know more details about Symfony project, use the below command.  php bin/console about Setting environment In the root path, copy .env.test file to .env and add the below database details in it. DATABASE_URL="mysql://root:root@127.0.0.1:3306/persons" You will also need to configure Symfony with apache web server. For the live server, you will need fully-featured web server. Run the below command to install apache symfony pack. composer require symfony/apache-pack This will add .htaccess file in public folder. You should define all apache rules in that file. To run Symfony commands, you can do anything from the below. Use it as a local file: /home/jitesh/.symfony/bin/symfony Or add the following line to your shell configuration file: export PATH="$HOME/.symfony/bin:$PATH" Or install it globally on your system: mv /home/jitesh/.symfony/bin/symfony /usr/local/bin/symfony Run the below command to start symfony server symfony server:start And open web browser and open http://localhost:8000/. You will see welcome page. I hope it will help you.