Skip to content

A basic and lean recipe for connecting to MySQL in Symfony3.

Notifications You must be signed in to change notification settings

thezendguy/php-symfony-dbconnection

Repository files navigation

php-symfony-dbconnection

A basic and lean recipe for connecting to MySQL in Symfony3.

This application will connect to the local mysql server, create a new database called psd and a new table inside this called product. When the application is loaded in the browser, a Product object will be inserted into the database, and the details of this will be displayed on the page.

Dependencies

git
php v5.5.9
composer
MySQL

To install

$ mkdir -vp php-symfony-dbconnection  
$ cd php-symfony-dbconnection  
$ git clone https://github.com/benjaminvickers/php-symfony-dbconnection.git .  
$ composer install

Enter the database connection details when prompted by composer. Otherwise you can edit the details in the app/config/parameters.yml file. Remember the database name should be set to psd.

To setup

$ sudo service mysql start
$ php bin/console doctrine:database:create  
$ php bin/console doctrine:schema:update --force

To run in dev mode

$ php bin/console server:run

To test in a browser

http://localhost:8000

About

A basic and lean recipe for connecting to MySQL in Symfony3.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published