NATHAN242's Projects

Projects

Tools

Libraries

Web Tools


PHP-MVC

Project repo: LINK

Introduction

This is a PHP MVC framework I have been developing for curiosity/learning/experimental purposes. This has been built from the ground up in an original way and I am trying to find my own ways to implement functionality without just copying the usual patterns.

Features

Details

The framework is contained in the Framework folder and one or more web applications can also be set up at this level. A sample application is present in the Application folder. The framework and applications use the following folder structure:

The Framework directory contains a template directory that can be copied as a starting point for a new application.

All static site content (images, JS) should be under the www directory.

The index.php file acts as the front controller for the framework. The webserver should pass all requests to this file. If you are using the PHP built in web server it is best to use cli-server-index.php as this will allow static assets to be accessed. There is a .htaccess file for Apache HTTPD in the www folder that will pass all requests to the front controller.
The index.php file also serves as the entrypoint for cli commands. Running it via the php cli with no options will display the command help:

PHP-MVC Test Application [v0.0.1]

Available commands:
repl                      - Start interactive shell
create-users-table        - Create users table
create-test-table         - Create test table
dump-config               - Dump configuration of specified type
show-test-records         - Show records in the test table
no_method                 - Test missing method
no_controller             - Test missing controller

There is an included autoloader at Framework/include/autoloader.php but the composer autoloader can also be used.

The framework itself has a standalone CLI entrypoint at Framework/cli.php. Currently this only provides a simple PHP REPL option but could be used to add framework specific helper commands (create new application etc...) in the future.