From the course: Symfony 6 Essential Training
Local development - Symfony Tutorial
From the course: Symfony 6 Essential Training
Local development
- [Instructor] If you're a seasoned PHP developer you likely have a local development environment set up. But if you're new to PHP or exploring Symfony we will cover some options in this video. The simplest local dev option is going to be using the built-in web server from the Symfony CLI app. In your project directory, run symfony server start. When you run this your server address is displayed along with log messages. Symfony Server is not exclusive to Symfony Projects. In fact, you can run any PHP application or serve static assets. A cool feature in the Symfony Server is the ability to use different versions of PHP provided you have them installed on your computer. In addition, the Symfony Server supports local domain names. This can be helpful for local dev in situations where the domain is important to the app logic, like multi-tenancy situations. I'm not going to cover everything on Symfony local web server page, but know that it's out there and it's a cool tool. Of course, it's rare that you would have a PHP project that doesn't require some sort of database. If you're on a Mac check out DB engine. It offers a pretty simple way to spin up mySQL, Postgres or a Redis instance. If you aren't on Mac, MAMP is a pretty common solution. It includes both web server and database. Other standard local environments are things like Vagrant, Valet, and Docker. If you're already comfortable with those for local development, there is no sense changing. If you have a local stack you already know and like stick with that. But if you're still trying to decide, the Symfony CLI Server is a full featured and lightweight tool.