Skip to content

SekmSet/my-quizz

Repository files navigation

MVC_MY_Quiz

My first project with Symfony !

  • Register (with email validation) and login
  • CRUD user (with email validation when you change the password or email)
  • Play quiz
  • See your quiz history (if user is not authenticated, he can plays a quiz and see history)

With the admin role :

  • CRUD question
  • CRUD response
  • CRUD category
  • CRUD user

My app

Versions

  • PHP 7.4.5
  • Symfony 5.0.*
  • Composer 1.10.5

In local

Start and quite the server

You need to have instal Symfony before use the following command in your terminal. To instal Symfony, refer you to the links at the end of this readme

symfony server:start
ctrl + c

Database

Start migration to have all the tables :

php bin/console doctrine:migrations:migrate 

Don't forget to update your username, password and table in .env

To deploy : in your Google Cloud Platform create your database and an user

How to configure your variable ?

DATABASE_URL = mysql://username:password@localhost?unix_socket=/cloudsql/project_id:region:your_database;dbname=database_name

Admin

I used easyAdmin a Symfony bundle. To install easyAdmin I followed the instructions of the documentation.

Link of the documentation

Mail

Dev env.

MailTrap

Create your inbox then update your config in .env

Prod env.

Sendgrid

Create the API Key then update your config in .env

PS : if you don't receive the email think to check your indesirable email

Docker and Google Cloud

Create a docker directory, docker-compose.yml file and .dockerignore. In your docker directory you have to create the following folders : Dockerfile and opcache.ini

Make your migration on cloud

Create a .cloudbuild directory and a seeder-deploy.yaml in this directory.

EXPORT PROJECT_ID=your_project_id
EXPORT DOCKER_IMAGE=your_docker_image
EXPORT YOUR_TAG=name_of_your_tag

docker build -f docker/Dockerfile -t eu.gcr.io/${PROJECT_ID}/${DOCKER_IMAGE}:${YOUR_TAG} .
docker push eu.gcr.io/${PROJECT_ID}/${DOCKER_IMAGE}:${YOUR_TAG}

Start your migration with cloud build

gcloud builds submit \
  --project ${PROJECT_ID} \
  --config .cloudbuild/seeder-deploy.yaml \
  --substitutions "_SERVICE=${DOCKER_IMAGE}:${YOUR_TAG},_REGION=europe-west1,_INSTANCE_NAME=my-sql-database,_DATABASE_URL=mysql://login_database:password_database@localhost?unix_socket=/cloudsql/${PROJECT_ID}:europe-west1:my-sql-database;dbname=db_name"

DNS and Google Analytics

If you want to use Google Analytics or somthing else create your property and configure it (Google A.) Then add the code at the end of the template : base.html.twig

To use a DNS add your DNS in your Cloud DNS and add a mapping to your service

Links

  • Link to download : Link
  • Link to install and configure Symfony : Link
  • Composer : Link

Preview

article article article article article article article article