How iyinoluwagideon/library-mvc works
Library MVC is a framework-free PHP/MySQL library application. A browser request enters the front controller, which configures the custom router and its routes; handlers perform authentication, catalog, borrowing, return, profile, and administrative work through models, while view controllers render pages. The README documents inventory, search, image uploads, and overdue fines. Some controller-to-model wiring is visible in the SOURCE INDEX rather than excerpts; links to unsampled subsystems are included only where routes or documented capabilities support them.
Main entry points: index.php Front controller · Router.php Custom router · Controllers Account handlers · Book.php Book and inventory
Components 18
Request routing
- Front controller
public/index.php - Custom router
core/Router.php - PDO connection
core/Database.php
Accounts and profiles
- Account handlers
src/Controllers - Account pages
src/Views - User model
src/Models/User.php - Profile views
src/Views/userprofile.php
Catalog and inventory
- Catalog handlers
src/Controllers - Catalog pages
src/Views - Book and inventory
src/Models/Book.php - Image upload helper
src/helper/upload.php
Borrowing and records
- Circulation handlers
src/Controllers/HandleBorrowBook.php - Return handler
src/Controllers/HandleReturn.php - Borrowing records
src/Models/Borrow.php - Dashboard and records
src/Views/dashboard.php - User records page
src/Views/userrecord.php
Other components
- Library visitor
- MySQL database
Connections 28
- Library visitor → Front controller: sends request
public/index.php - Front controller → PDO connection: opens connection
public/index.php - Front controller → Custom router: registers routes
public/index.php - Front controller → Custom router: dispatches request
public/index.php - Custom router → Account handlers: dispatches account routes
core/Router.php - Custom router → Catalog handlers: dispatches catalog routes
core/Router.php - Custom router → Circulation handlers: dispatches circulation routes
core/Router.php - PDO connection → MySQL database: connects PDO
core/Database.php - Front controller → User model: creates with PDO
public/index.php - Front controller → Book and inventory: creates with PDO
public/index.php - Front controller → Borrowing records: creates with PDO
public/index.php - Account handlers → User model: uses account data
src/Controllers/HandleRegistration.php - Account handlers → Image upload helper: uploads profile image
src/Controllers/HandleEditProfile.php - Account handlers → Account pages: serves account pages
src/Controllers/ViewDashboard.php - Account handlers → Profile views: loads profile
src/Controllers/ViewUserProfile.php - Catalog handlers → Book and inventory: manages books
src/Controllers/HandleAddbook.php - Catalog handlers → Image upload helper: uploads book image
src/Controllers/HandleAddbook.php - Catalog handlers → Catalog pages: serves catalog pages
src/Controllers/ViewDashboard.php - Circulation handlers → Borrowing records: creates borrow record
src/Controllers/HandleBorrowBook.php - Circulation handlers → Book and inventory: checks availability
src/Controllers/HandleBorrowBook.php - Return handler → Borrowing records: updates return and fine
src/Controllers/HandleReturn.php - Return handler → Book and inventory: restores inventory
src/Controllers/HandleReturn.php - Circulation handlers → Dashboard and records: redirects after borrow
src/Controllers/HandleBorrowBook.php - Custom router → Dashboard and records: renders dashboard
core/Router.php - Custom router → User records page: routes records page
- Book and inventory → MySQL database: queries catalog
src/Models/Book.php - Borrowing records → MySQL database: queries borrow records
src/Models/Borrow.php - User model → MySQL database: queries users
src/Models/User.php