DEV Community


Posted on • Updated on

Building a PHP CMS from Scratch without a Framework

PHP is used by 79.2% of all the websites whose server-side programming language we know. However it can be particularly complicated to create a scaled CMS application without a framework. Although using right design practices it is possible to implement a solution.

I built a blogging platform called Luminosity

You can inspect the code here as you read along.


Remote repository for Luminosity - The Modern Blogging Platform.


  • Find articles on various topics
  • Follow other users
  • Use a web-friendly interface to create posts
  • Create drafts before publishing articles
  • Comment and react on articles
  • Bookmark articles
  • Customize your profile
  • Responsive Design and Dark Mode option

Create Drafts and Articles

Explore Articles

Customize your profile


The project implements Model-View-Controller design pattern. This project has been built using a custom framework

Model–view–controller (usually known as MVC) is a software design pattern commonly used for developing user interfaces that divides the related program logic into three interconnected elements. This is done to separate internal representations of information from the ways information is presented to and accepted from the user.


The Model component corresponds to all the data-related logic that the user works with. This can represent either the data that is being transferred between the View and Controller components or any other business logic-related data. For example, a Customer object will retrieve the customer information from the database, manipulate it and update it data back to the database or use it to render data.


The View component is used for all the UI logic of the application. For example, the Customer view will include all the UI components such as text boxes, dropdowns, etc. that the final user interacts with.


Controllers act as an interface between Model and View components to process all the business logic and incoming requests, manipulate data using the Model component and interact with the Views to render the final output. For example, the Customer controller will handle all the interactions and inputs from the Customer View and update the database using the Customer Model. The same controller will be used to view the Customer data.

A common example is ASP.NET MVC

Project Structure

application/ App Logic and Backend

  • Config - Configuration items and files
  • Libraries - Base classes and main libraries used by derived classes
  • Controllers
    • Ajax Controllers - Handle internal API requests. (Returns: JSON)
    • Controller Traits - Configuration values for controllers
    • View Controllers - Load appropriate view and display data
  • Helpers - Includes common utility functions used across the application
  • SQL - Contains SQL Dump and Procedures for Models
  • Views - Each view controller has unique view folder with different pages (default index.php)
  • Vendor - External Packages used by PHP
  • Bootstrap.php - The bootstrap file builds the application by including the setup files and starting the session. It also initializes the class and vendor autoloaders.

public/ Application frontend

  • index.php - Main file

.htaccess Route Requests through Public folder

Packages used

Setup Luminosity

Follow the Installation Guide to set up Luminosity.


You may open an issue here

Be sure to star the repository and follow me on Github :)

Top comments (0)