Skip to content

banezaklan/bmvc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


BMVC an attempt to create a simple PHP MVC framework

I did it mainly as an exercise to better learn and understand MVC pattern.
Difference to multitude of MVC frameworks out there would be attempt to make it
as object oriented as possible but simple to setup, use and extend to ones needs.

Files are split in four folders: controller, model, view and system.

System folder contains MVC base class files and few helper classes. Other folders
contain MVC related files, which makes the web application.

All MVC classes inherit the same parent class: bmvc_base, which purpose is to 
provide globally used objects and config data. For example it would be a place 
to put session and access control related functionality, etc.
Per MVC design logic, there are three base classes controller_base, model_base 
and view_base, which are either used directly or further extended depending on
the website structure requirements.
Example of extending the base class would be the controller_main_layout class, 
which is used to provide a way to change entire layout of the site by changing a 
layout view object used in the class. Note that site layout view uses the same 
class as other views.

There are few naming rules as a result of the way routes are decoded.
Controller class must have 'controller_' prefix and action methods must have
'action_' prefix. 

The rules of the url are as follows:
www.mysite.com/controller/action/para0/para1/para2.../para5

URL rewriting will route all incoming requests to index.php which will process
them.


Installation:
Copy all the files into your www/bmvc folder. If it is localhost you will run it 
on, then name the folder bmvc as config is already setup like that. If not look
at things to configure below.

Create the database from the script bmvc_articles_schema.sql. It is MySql dump,
so it will create and name the database 'bmvc' and will contain some demo data.

Things to configure:
/system/bmvc_config.php - set your url root (if it is not http://localhost/bmvc )
/system/db_connection.php - set your DB connection

Go to http://localhost/bmvc and you should see the home page.

Demo app is standard blog-like, articles/comments type of website. It has minimal
functionality, no user access control and no input control, so it is obviously 
not intended for production.

Have Fun,
Bane

About

Very simple PHP MVC framework

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published