Le Quai Antique is a hypothetical school project : ECF's exam topic.
This is the website of the Savoyard restaurant Le Quai Antique in Chambery. It serves traditional dishes brought up to date. It's Arnaud Michant's third restaurant. The Chef wants to offer an authentic gastronomic experience without pretention, creating dishes that allow the local ingredients their rightful place.
See the website : Le Quai Antique
- How to use ?
- Prerequisites
- Installation
- Run
- Add an administrator
- Built with
- Deploying
- Tests
- Author
- License
-
MySQL version 5.7.32
-
PHP 8.1
-
Composer version 2.4.1
-
The Symfony CLI version 5.4.13
(cf. the usual Symfony application requirements).
-
Download the zip or clone the project in local :
git clone https://github.com/Melissa-code/quai_antique.git -
Move into the directory :
cd /path/to/the/file/quai_antique -
Open the project with a code editor, for instance PHPStorm.
-
Copy/Paste the .env file in a new file .env.local:
cp .env .env.local -
Change the credentials of the connection to the database in the .env.local file :
DATABASE_URL=mysql://root:root@127.0.0.1:8889/quai_antique?serverVersion=5.7 -
Install the Composer dependencies
composer install -
Create the database named quai_antique :
php bin/console doctrine:database:create -
Make a migration :
php bin/console make:migration -
Send the data to the database :
php bin/console doctrine:migrations:migrate
-
Start the local web server :
symfony server:start -
Open your browser and navigate to http://localhost:8000/
-
To stop it :
symfony server:stopor press both :ctrl + C
-
Delete the migration file in the project,
-
Delete the database with the command :
php bin/console doctrine:database:drop --force -
Create again the database :
php bin/console doctrine:database:create -
Make a migration :
php bin/console make:migration -
Load the data fixtures :
php bin/console doctrine:fixtures:load
- Create a new user with the Create a new account form of the application
- Use in the terminal :
php bin/console doctrine:query:sql "UPDATE user SET user.roles = '[\"ROLE_ADMIN\"]' WHERE user.id = 1;"
- Symfony (Symfony Documentation Symfony Documentation).
- PHP (PHP Documentation PHP Documentation).
- Doctrine (Doctrine ORM Documentation Doctrine Documentation).
- SQL (SQL Documentation SQL Documentation).
- Twig (Twig Documentation Twig Documentation).
- HTML CSS (HTML CSS MDN Documentation MDN Documentation) & (W3School W3School).
- Bootstrap (Bootstrap Documentation Bootstrap Documentation).
- Lightbox for Bootstrap (Ekko Lightbox Ekko Lightbox).
- JavaScript (JavaScript Documentation MDN JavaScript Documentation).
- Axios (Axios Documentation Axios).
- Moment.js (Moment.js Documentation Moment.js).
- Git (Git Documentation Git Documentation).
- FontAwesome (Fontawesome Fontawesome) and CDN font-awesome (CDN font-awesome CDN font-awesome).
- Noun Project (Noun Project Noun Project).
- GitHub (GitHub GitHub).
- PHPStorm version pro
The production deployment of Le Quai Antique is hosted on Heroku.
-
Install Git and Initialize a Git repository
-
Create a Heroku account
-
Install the Heroku CLI, for instance for MacOS use :
brew tap heroku/brew && brew install heroku(cf. Heroku Documentation Heroku Documentation).
Verify the installation using :
heroku --version
-
Check if
APP_ENV=prodin the .env file and empty the cache using :php bin/console cache:clear -
Login to Heroku with the command :
heroku login -
Create a new project :
heroku create le-quai-antique-restaurant -
Configure Symfony to run in the prod environment :
heroku config:set APP_ENV=prod -
Remote the local project to the Heroku app :
git add .git commit -m "Deploying of the project."git push heroku main(cf. Deploying Symfony 4/5/6 Apps on Heroku Deploying Symfony 4/5/6 Apps on Heroku).
-
Create a new MySQL database with the Addon JawsDb :
heroku addons:create jawsdb:kitefin(cf. Install JawsDB MySql JawsDB MySQL).
-
Create a new environment variable named "DATABASE_URL" on the dashboard of Heroku --> settings --> Reveal Config vars : copy/paste the value of the JAWSDB_URL to add it to the key DATABASE_URL and click on the Add button.
-
Get the DATABASE_URL:
heroku config:get DATABASE_URL -
Import the local database to the new database :
mysql -h hostname -u username -ppassword database < quai_antique.sql -
Deploy again :
git add .git commit -m "Create a database"git push heroku main -
Comment the lines 52 and 53 :
RewriteCond %{ENV:REDIRECT_STATUS} =""RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L] -
Add the code :
RewriteCond %{HTTP:X-Forwarded-Proto} !httpsRewriteCond %{ENV:REDIRECT_STATUS} ^$RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] -
Create if necessary a new user with the Create a new account form of the application
-
Use in the terminal :
heroku run php bin/console doctrine:query:sql "UPDATE user SET user.roles = '[\"ROLE_ADMIN\"]' WHERE user.id = 1;"
Melissa-code