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.
Before creating your first Symfony application you must have installed:
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
In the root path, copy .env.test file to .env and add the below database details in it.
DATABASE_URL="mysql://root:[email protected]: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.
Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]
jQuery add content at the beginning of selected element using prepend
In the previous article, we have discuss...How to get the values of selected checkboxes in a group using jQuery
Use the jQuery :checked select...How to convert special HTML entities back to characters in PHP
Use the PHP htmlspecialchars_decode...Upload Multiple Images With Preview Using Javascript
Image uploading is very common functiona...How to get Current User Location in Laravel 7
In this tutorial, i am going to show you...