A modern, maintainable PHP blog platform built as a University of Moratuwa IN2120 web programming project. Designed for easy local development, clear separation of concerns, and safe deployment practices.
- Summary
- Features
- Technology stack
- Prerequisites
- Installation — Local (XAMPP)
- Configuration
- Database
- Running the app
- Project structure
- Security & secrets
- Contributing
- License
- Author
Blog Hut is a full-featured blogging application with user authentication, CRUD for posts, comments, reactions, categories, and an admin dashboard. It is intended for learning and demonstration purposes.
- User registration, login, logout, and password recovery
- Create / edit / delete posts with image uploads
- AJAX comments and reaction system
- Categories and search
- Admin panel for content and user management
- Profile pages and avatars
- Responsive UI with light/dark support
- PHP 8+
- MySQL 8+
- Apache (XAMPP)
- Frontend: HTML5, CSS3, JavaScript (ES6), Bootstrap 5
- Optional: Composer for PHP dependencies
- XAMPP (Apache + MySQL + PHP) or equivalent environment
- Git (for version control)
- Composer (if using external PHP packages)
- Clone or copy the project into XAMPP's htdocs:
- C:\xampp\htdocs\BLOG_APP
- Start Apache and MySQL in the XAMPP control panel.
- Import database:
- Open phpMyAdmin -> Create database
blog_hut-> Importdatabase.sql.
- Open phpMyAdmin -> Create database
- Configure environment (see next section).
- Ensure upload folders are writable:
uploads/avatars/anduploads/posts/
Create a local environment file (.env) or update config/database.php with your database credentials. Example .env:
- Schema and sample data are provided in
database.sql. - Main tables:
users,blogPost,comments,reactions,categories,badges,user_badges.
Open your browser and navigate to: http://localhost/BLOG_APP
- admin/ — Admin pages
- auth/ — Authentication pages
- config/ — Database and constants (do not commit secrets)
- includes/ — Shared components and helpers
- posts/, profile/ — Public and user content pages
- uploads/ — User uploaded files (do not commit)
- css/, js/, images/ — Static assets
- Add
.env,config/database.php, anduploads/to.gitignore. - Use
config/database.php.exampleor.env.examplein the repo for reference without real credentials. - If secrets were accidentally committed, remove them from the git index and rotate credentials:
- git rm --cached .env
- git commit -m "Remove sensitive files"
- git push
- Fork the repository, create a feature branch, test locally, and open a PR with a clear description.
- Keep commits focused and include migration or config notes if needed.
MIT — see LICENSE file for details.
University of Moratuwa — IN2120 Web Programming Project (2025)