Brahim Elhoube

Web Development

Light PHP Framework

A lightweight PHP MVC framework inspired by Laravel, built to study routing, requests, responses, persistence, views, forms, sessions, and OAuth integration.

Open project

Abstract

This project explores the internal structure of a lightweight PHP MVC framework inspired by Laravel. The goal was to understand how routing, request handling, responses, views, forms, database operations, sessions, and third-party authentication can be organized into an extensible object-oriented architecture.

Problem

Frameworks such as Laravel expose elegant abstractions, but their source code can be difficult to study as a first step because production frameworks contain many layers, conventions, and edge cases. I wanted a smaller implementation that made the core request-response lifecycle easier to reason about.

Method

Core Application Flow

The first step was to create an Application class that acts as the main coordinator for the framework. I then implemented Route, Request, and Response classes to map incoming endpoints to application logic using a routing syntax inspired by Laravel.

Extended Features

After working with a basic request-response app, I aimed to add the following improvements:

  • OAuth providers API implementation: Google, Facebook, and GitHub
  • Basic ORM and database querying methods
  • Views manipulation methods
  • Form builder and validation
  • Session management and flash messages

Outcome

The project helped translate framework concepts from abstract usage into concrete implementation. It provided hands-on practice with object-oriented design, application bootstrapping, routing, state management, and the tradeoffs involved in designing reusable developer-facing APIs.