Skip to content

An MVC & AJAX based PHP Framework & Demo CRUD app made from scratch, pure PHP only

Notifications You must be signed in to change notification settings

shawn-dsilva/boomer-php-mvc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Boomer PHP MVC

This is a PHP Framework made by Shawn D'silva to learn MVC Architecture, SQL based CRUD and AJAX from scratch using Linux, Apache, MySQL and PHP , No JavaScript or PHP Frameworks used and neither are any PHP packages or libraries, The Front-End for the demo app is made with with custom CSS & JQuery.
This Project supports Docker and is deployed in Docker containers, The Docker deployment consists of a MySQL container with an Apache2 server + PHP7.2 apache mod, which runs the web app.

Quickstart

  • You need docker and docker-compose for this.
  • Run docker-compose up
  • Site is hosted on localhost:5003 by default.

Usage

  • Entry point for the web app is in index.php which lives in the public folder, which also contains .css and .js in their respective folders
  • PHP application code goes in app which contains controllers, views , models and routes.
  • The core Framework PHP code is in core which contains the database,sessions,router,middlewares,utils and base controller and models logic
  • Application controllers and models inherit from controller and models in core which encapsulte the parameter or middleware data for controllers from the routes or expose the database functions and Query Builder for the models

Main Features

  • Created using only pure PHP, no frameworks or external libraries.
  • MVC CRUD App with AJAX features where required
  • Router with support for parameterized dynamic routes and protected routes.
  • Route parameters can be accessed in controller, so can the data output by Middlewares
  • Sessions based authentication, with only sessionId stored in cookie, and user data stored in database.
  • Validation library to check user input.
  • Middleware support for specific routes.
  • Database abstraction using a Query Builder for MySQL.

Completed Tasks

  • Skeleton files and directory setup
  • Basic router setup with controllers and views
  • Creating core Model methods
  • Login/Registration functionality
  • Sessions setup
  • Redirects based on Auth status stored in Session cookie/ Protected Routes
  • Store user data upon login into sessions database and return sessionId
  • Store sessionId cookie.
  • Get and display user data from sessions table by verifying sessionId with database.
  • Session deletion upon Logout.
  • Input sanitization/validation for Login and Registration
  • Error Message display using AJAX In the same page.
  • Login refactor into AJAX.
  • Registration refactor into AJAX.
  • JavaScript refactor from script tags to .js files.
  • Modify Router so it can work even with parameterized/dynamic routes.
  • Get username from route parameter, retreive user data, and display it.
  • Add functionality for users to add blog posts
  • List of Posts by a user in his dashboard
  • Add Posts refactor into AJAX
  • Get Posts refactor into AJAX
  • Add Delete functionality for Posts
  • Get Single Post and Display it
  • Add Edit functionality for Posts
  • Frontend design for homepage, login/registration
  • setup.php script to setup Database with tables
  • Navbar should show Logged in status
  • Fix broken isAuth middleware based routing
  • Add more CRUD fields for User model
  • Frontend design for User profiles
  • UI Fixes
  • Add front-end edit profile features
  • Fixes to protected routes
  • Add backend edit profile features
  • Profile page PHP/HTML refactored
  • SQL Join in Query Builder
  • Get user data from session changed to SQL Join
  • List of all posts by logged in user with links to edit, delete and view full post
  • Style Create Post page
  • Get selected text from input
  • Get Single Post basic CSS styling
  • Posts in /postlist link to single post
  • Comment Model
  • Comment Controller
  • Get Single Post complete CSS styling
  • Get Comments List via AJAX call
  • Add Comment and reload comments list on submit
  • Comment created_at field translated to human readable field in PHP itself, instead of using JS.
  • Returning data of a post with author data using SQL Join.
  • Post author and submition date below title.
  • Delete Posts using delete button UI
  • User can edit a post only if he is the post author
  • Style Error Page
  • Only Authors of commments can see edit/delete buttons
  • Delete comment if Author of Comment
  • Edit Comment Front-end done.
  • Edit comment if Author
  • Comments with CRUD functions from registered users
  • Publicly viewable user Profile styling.
  • List of all users registered
  • User List Page CSS styling
  • Check for User data associated with sessionId in isAuth middleware
  • getView reworked to automatically add user data from sessions into views
  • List of latest posts from all users
  • Refactor BaseController.php into RouteHandler.php.
  • Refactor all controller classes into object based from static
  • New BaseController Class for other Controller classes to inherit from.
  • Refactor Sessions related code into seperate sessions folder in core
  • Refactor code for Routes list into seperate routes folder in app
  • Refactor all routers in RoutesController.php into routes folder inside 'app folder
  • The routes folder must contain routes grouped by their function in a single file
  • Refactor into proper baseurl setup
  • Refactor resource routes(css,js,image) into its own controller in core

In Progress

  • Delete previous session ID entries from DB Upon new session creation
  • Input validation for all new features
  • Rate Limiting
  • Redo CSS in SASS

TO-DO

  • Schema Builder
  • Upvotes and Downvotes from users

Author


Shawn D'silva

About

An MVC & AJAX based PHP Framework & Demo CRUD app made from scratch, pure PHP only

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published