Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jmdeldin/php_mvc

Simple MVC framework in PHP
https://github.com/jmdeldin/php_mvc

Last synced: about 1 month ago
JSON representation

Simple MVC framework in PHP

Awesome Lists containing this project

README

        

Really Simple PHP MVC
=====================

This is an example of a really simple PHP application that implements the
Model-View-Controller pattern [1]. It's meant to be instructive, which is why
it doesn't implement features like ORM or authentication found in popular
frameworks.

Overview
--------

To understand this project, open "pub/index.php". This file configures the
basic constants like `ROOT` and APP_PATH`. It then calls "app/bootstrap.php",
which configures the autoloading of our classes. Finally, we start the
application by calling the `delegate` method of "app/classes/Router.php". The
routing performed in `Router` is the core of this framework. It is responsible
for mapping URIs like

to the appropriate controller. Aside from this class, everything else can be
modified/discarded. The codebase is tiny (~264K with examples), so it should
be easy enough to grasp. Feel free to contact me with any question [2].

Note: The .htaccess file is _not_ required, but it is used in the examples. If
you'd rather not use it, use `/index.php?route=` instead.

Filesystem
----------

|-- app => site root (not web-root)
| |-- classes => non-(model|controller) classes
| |-- controllers => controller (FooController.php)
| |-- models => model classes (FooModel.php)
| `-- views => simple templating files
`-- pub => web root

Links
-----

[1]
[2]