Custom PHP Framework

PHP MySQL OOP MVC API

Project Overview

HAPI is a PHP-based web application framework that uses a hierarchical, modular architecture designed to streamline application development and simplify debugging through a structured four-layer abstraction system. Inspired by the OSI model, this stack is called H.A.P.I. and is organized into the following layers:

• Drivers: This foundational layer abstracts external library code or core hardware interactions that rarely require modification.

• Handlers: Serving as the application's engine, this layer houses classes containing the majority of the processing logic. Handlers manage and orchestrate the lower-level driver classes, requesting and processing data to pass up to the layer above.

• Modules: This presentation layer contains classes tasked with rendering the data received from the handlers. Each module operates independently, focusing strictly on its own layout and isolation.

• Interfaces: The final layer integrates multiple modules into a unified presentation. This can range from a graphically complex user dashboard to a streamlined API endpoint that formats and delivers data according to the requested protocol.

Key Features

  • Custom-built PHP framework from scratch
  • Object-oriented PHP design
  • Role-based access control and user authentication
  • Dynamic role-based menu system
  • Dynamic module system for extensibility
  • AJAX-powered interface for seamless user experience
  • Adapter pattern for swappable database layer
  • active record type class for contained data handling

Technical Implementation

The framework demonstrates advanced PHP OOP concepts, modular architecture with separate Controllers and Modules, and clean separation of concerns. The codebase shows patterns for building scalable PHP applications without a heavy, death-by-abstraction, framework. A Composite structural design limited to 4 levels is strictly used. A class from one level can only contain classes from the next level down.

HAPI follows a layered architecture:
  1. Drivers (Hardware) - Low-level abstractions for database, config, email, files, etc.
  2. Handlers (Application) - Domain models/data access objects extending `BaseHandler` (Active Record pattern)
  3. Modules (Presentation) - Application logic/controllers extending `AbstractModule`, organized by feature
  4. Entry Points (Interface) - `index.php` (login), `interface.php` (main app), `api.php` (AJAX/API), `setup.php` (DB setup)

Project Details

Duration:
2010 - Present
Role:
Lead Developer & Architect
Type:
Web Application Framework

Repository

Github