Database Setup - MiguelFieira/AMO-HANDBOEK GitHub Wiki
Symfony is a PHP framework for web applications and a set of reusable PHP components. Symfony is used by thousands of web applications (including BlaBlaCar.com and Spotify.com) and most of the popular PHP projects (including Drupal and Magento).
Symfony doesn't provide a component to work with the database, but it does provide tight integration with a third-party library called Doctrine. This library will be installed when installing the Symfony Skeleton (What was explaind in 1.0 | Setup). Doctrine will help you with things like setting up the database, creating Entities/tables and making queries.
Create connection with your database
- Go your project and find the
.envin the root map.
- Find the line:
DATABASE_URL=mysql://db_user:[email protected]:3306/db_nameon line:27
-
Now you have to change the settings of the
DATABASE_URL:3.1. Replace db_user with the username of your database (on a local database this is
root)3.2. Replace db_password with the password of your database (on a local database this is empty
DATABASE_URL=mysql://[email protected]:3306/db_name)3.3. Replace 127.0.0.1 with the address of your database and 3306 with the port of your database (on a local database the address is
127.0.0.1and the port3306). You need the separate the address and the port with:. (so a local database address will look like this:127.0.0.1:3306)3.4. Replace db_name with the name of your database you want to create
3.5 When running a local database it wil looks something like this:
DATABASE_URL=mysql://[email protected]:3306/croco -
Open your terminal in the root map of your project (don't forget to run your sql server)
php bin/console doctrine:database:create
// This will create a database


