Skip to content

sahilmate/bookbazaar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BookBazaar: Online Book Store

An online book store built with PHP, MySQL, HTML/CSS, JavaScript, and Stripe for payment processing. This project allows users to browse, search, and purchase books, while administrators can manage products, orders, and user data.

Table of Contents

  1. Description
  2. Features
  3. Requirements
  4. Installation
  5. Configuration
  6. Usage & Navigation
  7. Screenshots
  8. Stripe Test & Verification
  9. Contributing
  10. License

Description

BookBazaar provides a simple and intuitive way for customers to explore a curated selection of books, add them to a cart, and proceed to checkout using Stripe for secure payments. Administrators have a dedicated panel to add/edit/delete books, manage orders, and view messages from users.


Features

  • User Registration & Login
    • Standard account creation and login process.
  • Product Browsing & Search
    • Browse a list of books with images, descriptions, and prices.
  • Shopping Cart
    • Add items to the cart, update quantities, and remove items.
  • Secure Checkout
    • Integrated with Stripe for payment.
  • Admin Panel
    • Manage books, orders, users, and messages.
  • Responsive UI
    • A clean layout that adjusts to different screen sizes.

Requirements

  1. PHP 7.4+
  2. MySQL (e.g., via XAMPP or WAMP)
  3. Composer
  4. Stripe Account (for test and/or production keys)

requirements.txt

While PHP projects typically use Composer instead of requirements.txt, here’s a minimal list of what you’ll need:

php >= 7.4
composer
vlucas/phpdotenv
stripe/stripe-php

(Install actual dependencies via Composer — see Installation below.)


Installation

Follow these steps to get the project running on your local machine:

  1. Clone the Repository

    git clone https://github.com/sahilmate/bookbazaar.git
    cd bookbazaar-main
  2. Move into htdocs (XAMPP) or www (WAMP)

    • If using XAMPP on Windows, place the entire project folder inside C:\xampp\htdocs\.
    • If using MAMP on macOS, place it inside Applications/MAMP/htdocs/.
    • If using WAMP, place it inside the www folder.
  3. Install Composer Dependencies (or install Composer)

    composer install

    Alternatively try

    composer require stripe/stripe-php
    composer require vlucas/phpdotenv

    This will create a vendor/ folder containing all necessary libraries (e.g., stripe-php, vlucas/phpdotenv).

  4. Import the Database

    • Open phpMyAdmin in your browser.
    • Create a new database, e.g. shop_db.
    • Import the SQL file (e.g., shop_db.sql) into that database which is present in the repository.
  5. Configure .env

    • Create a new file named .env in the root of your project (same level as config.php, etc.).
    • Add the following lines (using your own Stripe keys):
      STRIPE_PUBLISHABLE_KEY=pk_test_1234567890
      STRIPE_SECRET_KEY=sk_test_1234567890
    • If you don’t have a .env file, copy the example below:
      # .env file
      STRIPE_PUBLISHABLE_KEY=pk_test_yourPublishableKey
      STRIPE_SECRET_KEY=sk_test_yourSecretKey
  6. Update config.php (if needed)

    <?php
    // Example config file
    $conn = mysqli_connect('localhost','root','','shop_db') or die('connection failed');
    
    // Load Composer autoload
    require 'vendor/autoload.php';
    
    // Load .env variables
    $dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
    $dotenv->load();
    
    // Stripe Keys from .env
    $publishableKey = $_ENV['STRIPE_PUBLISHABLE_KEY'];
    $secretKey = $_ENV['STRIPE_SECRET_KEY'];
    
    // Initialize Stripe
    \Stripe\Stripe::setApiKey($secretKey);
    ?>
  7. Run the Project

    • Start Apache and MySQL from your XAMPP/WAMP control panel.
    • In your browser, go to http://localhost/bookbazaar-main/home.php.

Configuration

.env File

Your .env file should include at least the Stripe keys:

STRIPE_PUBLISHABLE_KEY=pk_test_XXXXXXX
STRIPE_SECRET_KEY=sk_test_XXXXXXX
  • For production, replace with your live Stripe keys (and enable SSL).

Usage & Navigation

  1. Home Page

    • Displays featured books.
    • Users can view details, add to cart, or proceed to checkout.
  2. User Accounts

    • Default User:
      • Email: abc@gmail.com
      • Password: pass
    • You can log in as this user to simulate a typical shopping experience.
  3. Admin Accounts

    • Default Admin:
      • Email: xyz@gmail.com
      • Password: pass
    • Log in as this admin to manage products, orders, users, and more.
  4. Cart & Checkout

    • After adding items to the cart, users can checkout and pay with Stripe.

Screenshots

User Pages Admin Pages
Home Page Admin Page
About Page Admin Products Page
Orders Page Admin Orders Page
Shop Page Admin Users Page
Contact Page Admin Contact Page
Checkout Page Admin Stripe Dashboard
Admin Stripe Balance
Admin Stripe Integration

Stripe Test & Verification

  1. Test Card Numbers

    • Use 4242 4242 4242 4242 with any future expiration date (e.g., 12/34) and any CVC (e.g., 123) for a successful test payment.
    • See Stripe Docs for additional test cards (e.g., for declined payments).
  2. Verify in Stripe Dashboard

    • Log in to Stripe Dashboard.
    • Switch to Test Mode (toggle in the left menu).
    • Go to Integrations.
    • Toggle ON Enable card data collection with a publishable key.
    • Give a correct Shop Name.
    • Go to Balance to ensure payments are getting logged.

Contributing

Contributions are welcome! Here’s how you can help:

  1. Fork the project repository.
  2. Create a new branch for your feature/fix:
    git checkout -b feature/my-feature
  3. Commit your changes with clear commit messages:
    git commit -m "Add new feature"
  4. Push to your fork:
    git push origin feature/my-feature
  5. Create a Pull Request on GitHub.
    • Include a detailed description of your changes.

We’ll review your PR and merge if everything looks good!


License

This project is licensed under the MIT License. You’re free to modify and distribute it, but please give credit to the original author.


Questions or Feedback?

Feel free to open an issue or contact the maintainers. Happy coding!

About

BookBazaar is an online book store where users can browse, search, and purchase a wide variety of books. The platform offers a seamless shopping experience with features like user authentication, shopping cart, and secure payment integration using Stripe.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors