A simple CRUD Notes Application built using Core PHP, MySQL, and Dotenv.
- Create notes
- View all notes
- Update existing notes
- Delete notes
- Uses
.envfor secure configuration
- PHP (Core PHP, no framework)
- MySQL
- Composer
- vlucas/phpdotenv
- XAMPP (Apache + MySQL)
php-notes-app/
│── create.php
│── read.php
│── update.php
│── delete.php
│── db.php
│── .env
│── .gitignore
│── composer.json
│── vendor/
Before running this project, make sure the following are installed and running on your system.
---- ✅ a. Install XAMPP
- Download XAMPP from: https://www.apachefriends.org/
- Install it using default settings
---- ✅ b. Install Composer
Composer is used to install project dependencies.
-
Download Composer from: https://getcomposer.org/download/
-
During installation, when asked for PHP path, select:
C:\xampp\php\php.exe -
Finish the installation
You’re now ready to set up and run the project.
git clone https://github.com/Rush741/php-notes-app.git
cd php-notes-appPlace the project inside:
C:\xampp\htdocs\
Run inside the project folder:
composer installThis will generate:
vendor/vendor/autoload.php
Create a file named .env in the project root.
DB_HOST=localhost
DB_USER=root
DB_PASS=
DB_NAME=notesapp
DB_PORT=3306Open phpMyAdmin:
http://localhost/phpmyadmin
Run:
CREATE DATABASE notesapp;
CREATE TABLE notes (
id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(255) NOT NULL,
body TEXT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);-
Open XAMPP Control Panel
-
Click Start for:
- Apache
- MySQL
Open in browser:
http://localhost/php-notes-app/
db.phploads environment variables using Dotenv- Database connection is created using MySQLi
- Each CRUD operation is handled by a separate PHP file
- Prepared statements are used for secure queries
- Default MySQL port is 3306
- If your MySQL runs on another port, update
DB_PORTin.env - Restart Apache after changing
.env