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.
- Description
- Features
- Requirements
- Installation
- Configuration
- Usage & Navigation
- Screenshots
- Stripe Test & Verification
- Contributing
- License
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.
- 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.
- PHP 7.4+
- MySQL (e.g., via XAMPP or WAMP)
- Composer
- Stripe Account (for test and/or production keys)
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.)
Follow these steps to get the project running on your local machine:
-
Clone the Repository
git clone https://github.com/sahilmate/bookbazaar.git cd bookbazaar-main -
Move into
htdocs(XAMPP) orwww(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
wwwfolder.
- If using XAMPP on Windows, place the entire project folder inside
-
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). -
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.
-
Configure
.env- Create a new file named
.envin the root of your project (same level asconfig.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
.envfile, copy the example below:# .env file STRIPE_PUBLISHABLE_KEY=pk_test_yourPublishableKey STRIPE_SECRET_KEY=sk_test_yourSecretKey
- Create a new file named
-
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); ?>
-
Run the Project
- Start Apache and MySQL from your XAMPP/WAMP control panel.
- In your browser, go to
http://localhost/bookbazaar-main/home.php.
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).
-
Home Page
- Displays featured books.
- Users can view details, add to cart, or proceed to checkout.
-
User Accounts
- Default User:
- Email:
abc@gmail.com - Password:
pass
- Email:
- You can log in as this user to simulate a typical shopping experience.
- Default User:
-
Admin Accounts
- Default Admin:
- Email:
xyz@gmail.com - Password:
pass
- Email:
- Log in as this admin to manage products, orders, users, and more.
- Default Admin:
-
Cart & Checkout
- After adding items to the cart, users can checkout and pay with Stripe.
| User Pages | Admin Pages |
|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
|
![]() |
-
Test Card Numbers
- Use
4242 4242 4242 4242with 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).
- Use
-
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.
Contributions are welcome! Here’s how you can help:
- Fork the project repository.
- Create a new branch for your feature/fix:
git checkout -b feature/my-feature
- Commit your changes with clear commit messages:
git commit -m "Add new feature" - Push to your fork:
git push origin feature/my-feature
- Create a Pull Request on GitHub.
- Include a detailed description of your changes.
We’ll review your PR and merge if everything looks good!
This project is licensed under the MIT License. You’re free to modify and distribute it, but please give credit to the original author.
Feel free to open an issue or contact the maintainers. Happy coding!













