Skip to content

ADI-KOTKAR/Riddlezz

Repository files navigation


Riddlezz

Website using PHP with MongoDB Database and deployment on Heroku
Visite hosted website : https://bit.ly/ADI-KOTKAR_Riddlez
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents

About The Project

There are many great PHP websites available on GitHub, however, there are very few which explore new, fast and latest cloud databases like MongoDB Atlas. This is a simple website which is a result of Project assigned to me for my PHP Certification, so I tried my best to try something different and use all basic functionalities of PHP.

What's Different?

  • Use of NoSQL database instead of traditional MySQL database.
  • Use of PHPMailer which can be used from anywhere and system independent.
  • Use of MongoDB Atlas which handle large unstructured data in the form of JSON.
  • Use of Heroku platform for hosting PHP Website instead of traditional cpanel hosting platforms.

A list of commonly used resources that I find helpful are listed in the acknowledgements.

Built With

I am listing the main things which are needed for this project:

Getting Started

First of all you will need a database of your own which should be created in MongoDB Atlas , I created out cloud-database so that handling of data can be done in JSON format and high secuirity of database.

Create a free cluster in MongoDB Atlas with your account, configure all stuff like network access, database access, and create a database with collection by following structure:

Database : Riddlezz Collection : user_info

 [
    {
        '_id' : '',
        'email' : '',
        'contact_no' : '',
        'progress_count' : '',
        'points' : '',
        'incorrect_attempts' : '',
        'time_start' : '',
        'time_end' : '',
        'otp' : '',
        'verification' : ''
    }
 ]

A JSON file which contains all the Questions along with its question_number, question and answer.


[
    {
        'id' : '',
        'question' : '',
        'answer' : ''
    }
]

Prerequisites

  • PHP
  • MongoDB

Installation

Considering you have PHP environment set (XAMPP in my case) and composer installed.

  1. Generate your MongoDB encoded URL for connecting your site to Atlas.
  2. Clone the repo
git clone https://github.com/your_username_/Project-Name.git
  1. Run follwing command for initializing, this will create composer.json, composer.lock files.
composer init
  1. Install MongoDB PHP driver
composer require mongodb/mongodb
  1. Setup MongoDB PHP Driver by referring - https://docs.mongodb.com/drivers/php
  2. Add this to your php.ini file and start your Apache server:
extension=php_mongodb.dll
  1. Create a file named 'secret_key.php' in Database folder and write this code:
<?php 

    //Database Connection
    function connectDB(){
        $client = new MongoDB\Client(
            //your encoded url of atlas in quotes
        );

        $db = $client->Riddlezz;
        $collection = $db->user_info;
        
        //echo "Connected Succesfully";
        return $collection;
    }

?>
  1. In PHPMailer/index.php do the following changes mentioned in comments.
  2. Till here your website is ready for localhost, now lets move on hosting:
    • I have used Heroku platform for hosting, just create an account and an app with PHP environment.
    • We are basically hosting our github repo on Heroku with automated deployment ie. whenever I commit changes in my repo, it will automatically affect changes on my website.
    • Refer: https://youtu.be/zavb4WG8x-8
  3. You are ready to go!!!

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contributors

Contact

Contact Developer - Mail - developer.adi.kotkar@gmail.com

Project Link: https://github.com/ADI-KOTKAR/Riddlezz.git

About

Website using PHP with MongoDB Atlas and deployment on Heroku

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages