You will be shown how to set up a Symfony project on a local server using the Xampp development stack on a PC. Symfony 6 is the version used in this demo.
Xampp is a free and open-source cross-platform web service stack package. It is used by developers to launch PHP projects such as Symfony on their local computer in order to create and test programs locally.
Step 2. Install Xampp to your PC.
Double click on the Xampp installer that was downloaded and it should launch a wizard.
The default setup is normally recommended. Therefore, continually click next in each step until the wizard start installing all the packages.
Step 3. Install Symfony to Xampp.
Once the download is successful, there should be a Xampp folder in your C drive.
Please be sure to have composer installed globally on your PC for this step. Here is a tutorial on how to install Composer "https://wecode101.com/install-composer-on-windows-10". Otherwise, if you already have a Symfony project on your PC, copy and paste the project in "C:\xampp\htdocs".
Now, open your command prompt terminal and cd to the "xampp/htdocs" folder and run this command "composer create-project symfony/website-skeleton example-app" .
example-app is the name on the project so you can change that to whatever name you desire.
Step 4. During the command execution you might be prompted to include Docker configuration, type n. You can integrate Docker at a later time if your just starting with Symphony with Xampp.
Step 5. Start the Xampp servers
Launch the Xampp Control Panel via the Xampp app icon. If you cannot see the Xampp app icon just search for it in Windows search feature. Once the control panel is launched, click on the Apache and MySql start buttons. If port 80 and port 3306 are not available, you might get errors and the servers will not start.
Step 6. launch project
Once all the steps are completed successfully launch the Symfony project in a browser "http://localhost/yoursymfonyprojectname/public/". If you created the project from command line as in step 3 then your project name would be "example-app".
If the project does not launch straight away try running the command below from the root of your project, then refresh browser:
php bin/console server:run
Here is how to connect your project to the db on Xampp https://wecode101.com/how-to-connect-to-mysql-database-in-xampp-on-symfony-project