Define MVC: A front controller based MVC framework

Recommend this page to a friend!
  Info   View files Example   View files View files (206)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 261 All time: 7,674 This week: 336Up
Version License PHP version Categories
define-mvc 1.1GNU General Publi...5.5PHP 5, Libraries, Design Patterns
Description Author

This package implements a front controller based MVC framework.

It providers a router class that loads processes the current request URL and dispatches to the respective controller.

The package provides base classes for a controller, view, DAO, model, and service.

Picture of Nitesh Apte
  Performance   Level  
Name: Nitesh Apte is available for providing paid consulting. Contact Nitesh Apte .
Classes: 16 packages by
Country: India India
Age: 36
All time rank: 1377 in India India
Week rank: 136 Up17 in India India Down
Innovation award
Innovation award
Nominee: 3x

Winner: 1x

Details

Define MVC

Define MVC is a Front Controller based MVC framework for developing web based applications. It is an open source and will always remain.

The name Define because you can define it the way you want. I have tried to keep everything configurable.

IMPORTANT: While developing this framework, I had a virtual host created for it. Request you guys to do the same. Probably it will not work if you try to access it like htt://localhost/define-mvc/

Contribute

Please feel free to contribute. But try to keep the implementation simple so that a developer working for first time shouldn't find it difficult to understand and use it.

How to use it

Since it is a Front Controller based MVC, the URL should be in the following pattern:

http://www.domain.com/controller/action/param1-param2/

So, if the URL is http://www.example.com/user/profile/33-90/ then:

<pre> <code>

class UserController extends ApplicationController {

public function profileAction($param1, $param2) {
	// logic goes here
}

} </code> </pre>

Check IndexController inside application/controller to get an idea.

All the view files will be inside 'application/view/' folder.

You can add display value in view by using View object. For example:

<pre> <code> class UserController extends ApplicationController {

public function profileAction($param1, $param2) {
	$this->view->addObject("msg", "I am the value to be displayed.");
	$this->view->render('user');
}

} </code> </pre>

In 'view' folder, create a file named 'user.php', and put the following code:

<pre> <code> echo $msg </code> </pre>

All the files related to your project will be inside 'application' folder. However, you can change the configurations defined in 'configuration/define.inc'.

To test after importing the project in your local server, try accessing the following:

http://www.domain.com/

http://www.domain.com/index/default/me-you/

http://www.domain.com/index/test-from-service/

http://www.domain.com/index/test-from-dao/

where domain.com is your local server.

Configuration

Define MVC is completely configurable.

For example, you want your UserController to be UserXYZ go to 'configuration/define.inc' and change CONTROLLER_SUFFIX to XYZ. Similarly, you can change other configuration properties.

API Documentation

Check docs/index.html for API documentation.

TODO

// More documentation to come. However, it's open for contribution.

  Files folder image Files  
File Role Description
Files folder imageapplication (5 directories)
Files folder imageconfiguration (2 files)
Files folder imagedbscripts (6 files)
Files folder imagedocs (117 files, 1 directory)
Files folder imagelib (2 directories)
Files folder imagelogs (1 file)
Accessible without login Plain text file .htaccess Data Auxiliary data
Accessible without login Plain text file bootstrap.php Example Example script
Accessible without login Plain text file LICENSE Lic. License
Accessible without login Plain text file README.md Doc. Auxiliary data

  Files folder image Files  /  application  
File Role Description
Files folder imagebean (1 file)
Files folder imagecontroller (3 files)
Files folder imagei18n (8 directories)
Files folder imagemodel (2 directories)
Files folder imageview (2 files, 4 directories)

  Files folder image Files  /  application  /  bean  
File Role Description
  Accessible without login Plain text file .gitignore Data Auxiliary data

  Files folder image Files  /  application  /  controller  
File Role Description
  Plain text file ApplicationController.php Class Class source
  Plain text file ErrorController.php Class Class source
  Plain text file IndexController.php Class Example class

  Files folder image Files  /  application  /  i18n  
File Role Description
Files folder imagede (1 file)
Files folder imageen (1 file)
Files folder imagees (1 file)
Files folder imagehi (1 file)
Files folder imageita (1 file)
Files folder imagero (1 file)
Files folder imageru (1 file)
Files folder imageza (1 file)

  Files folder image Files  /  application  /  i18n  /  de  
File Role Description
  Accessible without login Plain text file .gitignore Data Auxiliary data

  Files folder image Files  /  application  /  i18n  /  en  
File Role Description
  Accessible without login Plain text file en.php Conf. Configuration script

  Files folder image Files  /  application  /  i18n  /  es  
File Role Description
  Accessible without login Plain text file .gitignore Data Auxiliary data

  Files folder image Files  /  application  /  i18n  /  hi  
File Role Description
  Accessible without login Plain text file .gitignore Data Auxiliary data

  Files folder image Files  /  application  /  i18n  /  ita  
File Role Description
  Accessible without login Plain text file .gitignore Data Auxiliary data

  Files folder image Files  /  application  /  i18n  /  ro  
File Role Description
  Accessible without login Plain text file .gitignore Data Auxiliary data

  Files folder image Files  /  application  /  i18n  /  ru  
File Role Description
  Accessible without login Plain text file .gitignore Data Auxiliary data

  Files folder image Files  /  application  /  i18n  /  za  
File Role Description
  Accessible without login Plain text file .gitignore Data Auxiliary data

  Files folder image Files  /  application  /  model  
File Role Description
Files folder imagedao (1 file, 1 directory)
Files folder imageservice (1 file, 1 directory)

  Files folder image Files  /  application  /  model  /  dao  
File Role Description
Files folder imageimpl (1 file)
  Plain text file ApplicationDAO.php Class Class source

  Files folder image Files  /  application  /  model  /  dao  /  impl  
File Role Description
  Plain text file IndexDAO.php Class Class source

  Files folder image Files  /  application  /  model  /  service  
File Role Description
Files folder imageimpl (1 file)
  Plain text file ApplicationService.php Class Class source

  Files folder image Files  /  application  /  model  /  service  /  impl  
File Role Description
  Plain text file IndexService.php Class Class source

  Files folder image Files  /  application  /  view  
File Role Description
Files folder imagecss (1 file)
Files folder imagefonts (1 file)
Files folder imageimages (1 file)
Files folder imagejs (1 file)
  Accessible without login Plain text file error.php Appl. Application script
  Accessible without login Plain text file index.php Appl. Application script

  Files folder image Files  /  application  /  view  /  css  
File Role Description
  Accessible without login Plain text file .gitignore Data Auxiliary data

  Files folder image Files  /  application  /  view  /  fonts  
File Role Description
  Accessible without login Plain text file .gitignore Data Auxiliary data

  Files folder image Files  /  application  /  view  /  images  
File Role Description
  Accessible without login Plain text file .gitignore Data Auxiliary data

  Files folder image Files  /  application  /  view  /  js  
File Role Description
  Accessible without login Plain text file .gitignore Data Auxiliary data

  Files folder image Files  /  configuration  
File Role Description
  Accessible without login Plain text file application.inc Conf. Configuration script
  Accessible without login Plain text file define.inc Conf. Configuration script

  Files folder image Files  /  dbscripts  
File Role Description
  Accessible without login Plain text file mongo.application.sql Data Auxiliary data
  Accessible without login Plain text file mssql.application.sql Data Auxiliary data
  Accessible without login Plain text file mysql.application.sql Data Auxiliary data
  Accessible without login Plain text file oracle.application.sql Data Auxiliary data
  Accessible without login Plain text file postgres.application.sql Data Auxiliary data
  Accessible without login Plain text file sqlite.application.sql Data Auxiliary data

  Files folder image Files  /  docs  
File Role Description
Files folder imageresources (11 files)
  Accessible without login Plain text file .gitignore Data Auxiliary data
  Accessible without login HTML file 404.html Doc. Documentation
  Accessible without login HTML file class-Application....tionController.html Doc. Documentation
  Accessible without login HTML file class-Application....rrorController.html Doc. Documentation
  Accessible without login HTML file class-Application....ndexController.html Doc. Documentation
  Accessible without login HTML file class-Application....ApplicationDAO.html Doc. Documentation
  Accessible without login HTML file class-Application.....Impl.IndexDAO.html Doc. Documentation
  Accessible without login HTML file class-Application....icationService.html Doc. Documentation
  Accessible without login HTML file class-Application....l.IndexService.html Doc. Documentation
  Accessible without login HTML file class-Define.Core.BaseController.html Doc. Documentation
  Accessible without login HTML file class-Define.Core.BaseDAO.html Doc. Documentation
  Accessible without login HTML file class-Define.Core.BaseModel.html Doc. Documentation
  Accessible without login HTML file class-Define.Core.BaseService.html Doc. Documentation
  Accessible without login HTML file class-Define.Core.Framework.html Doc. Documentation
  Accessible without login HTML file class-Define.Core.IBaseDAO.html Doc. Documentation
  Accessible without login HTML file class-Define.Core.IBaseModel.html Doc. Documentation
  Accessible without login HTML file class-Define.Core.IBaseService.html Doc. Documentation
  Accessible without login HTML file class-Define.Core.IDefine.html Doc. Documentation
  Accessible without login HTML file class-Define.Core.IRouter.html Doc. Documentation
  Accessible without login HTML file class-Define.Core.IView.html Doc. Documentation
  Accessible without login HTML file class-Define.Core.ObjectContainer.html Doc. Documentation
  Accessible without login HTML file class-Define.Core.Router.html Doc. Documentation
  Accessible without login HTML file class-Define.Core.View.html Doc. Documentation
  Accessible without login HTML file class-Define.DBDrivers.DatabaseBean.html Doc. Documentation
  Accessible without login HTML file class-Define.DBDri...atabaseFactory.html Doc. Documentation
  Accessible without login HTML file class-Define.DBDrivers.IDatabase.html Doc. Documentation
  Accessible without login HTML file class-Define.DBDri....MONGODBDriver.html Doc. Documentation
  Accessible without login HTML file class-Define.DBDrivers.MSSQLDriver.html Doc. Documentation
  Accessible without login HTML file class-Define.DBDrivers.MYSQLDriver.html Doc. Documentation
  Accessible without login HTML file class-Define.DBDrivers.MYSQLIDriver.html Doc. Documentation
  Accessible without login HTML file class-Define.DBDrivers.ORACLEDriver.html Doc. Documentation
  Accessible without login HTML file class-Define.DBDrivers.PDODriver.html Doc. Documentation
  Accessible without login HTML file class-Define.DBDri....POSTGREDriver.html Doc. Documentation
  Accessible without login HTML file class-Define.DBDrivers.SQLITEDriver.html Doc. Documentation
  Accessible without login HTML file class-Define.Excep...FoundException.html Doc. Documentation
  Accessible without login HTML file class-Define.Excep...eworkException.html Doc. Documentation
  Accessible without login HTML file class-Define.Exceptions.IException.html Doc. Documentation
  Accessible without login HTML file class-Define.Excep...oggerException.html Doc. Documentation
  Accessible without login HTML file class-Define.Excep...interException.html Doc. Documentation
  Accessible without login HTML file class-Define.Excep...ntimeException.html Doc. Documentation
  Accessible without login HTML file class-Define.IUtil...PasswordHelper.html Doc. Documentation
  Accessible without login HTML file class-Define.Traits.SingletonTrait.html Doc. Documentation
  Accessible without login HTML file class-Define.Utili...ceptionHandler.html Doc. Documentation
  Accessible without login HTML file class-Define.Utilities.IUtilities.html Doc. Documentation
  Accessible without login HTML file class-Define.Utilities.Localization.html Doc. Documentation
  Accessible without login HTML file class-Define.Utilities.Logger.html Doc. Documentation
  Accessible without login HTML file class-Define.Utilities.Session.html Doc. Documentation
  Accessible without login HTML file class-PHPMailer.html Doc. Documentation
  Accessible without login HTML file class-phpmailerException.html Doc. Documentation
  Accessible without login HTML file class-SMTP.html Doc. Documentation
  Accessible without login Plain text file elementlist.js Data Auxiliary data
  Accessible without login HTML file function-__autoload.html Doc. Documentation
  Accessible without login HTML file index.html Doc. Documentation
  Accessible without login HTML file namespace-Application.Controller.html Doc. Documentation
  Accessible without login HTML file namespace-Application.html Doc. Documentation
  Accessible without login HTML file namespace-Application.Model.DAO.html Doc. Documentation
  Accessible without login HTML file namespace-Applicat...Model.DAO.Impl.html Doc. Documentation
  Accessible without login HTML file namespace-Application.Model.html Doc. Documentation
  Accessible without login HTML file namespace-Application.Model.Service.html Doc. Documentation
  Accessible without login HTML file namespace-Applicat...l.Service.Impl.html Doc. Documentation
  Accessible without login HTML file namespace-Define.Core.html Doc. Documentation
  Accessible without login HTML file namespace-Define.DBDrivers.html Doc. Documentation
  Accessible without login HTML file namespace-Define.Exceptions.html Doc. Documentation
  Accessible without login HTML file namespace-Define.html Doc. Documentation
  Accessible without login HTML file namespace-Define.IUtilities.html Doc. Documentation
  Accessible without login HTML file namespace-Define.Traits.html Doc. Documentation
  Accessible without login HTML file namespace-Define.Utilities.html Doc. Documentation
  Accessible without login HTML file namespace-None.html Doc. Documentation
  Accessible without login HTML file source-class-Appli...tionController.html Doc. Documentation
  Accessible without login HTML file source-class-Appli...rrorController.html Doc. Documentation
  Accessible without login HTML file source-class-Appli...ndexController.html Doc. Documentation
  Accessible without login HTML file source-class-Appli...ApplicationDAO.html Doc. Documentation
  Accessible without login HTML file source-class-Appli....Impl.IndexDAO.html Doc. Documentation
  Accessible without login HTML file source-class-Appli...icationService.html Doc. Documentation
  Accessible without login HTML file source-class-Appli...l.IndexService.html Doc. Documentation
  Accessible without login HTML file source-class-Defin...BaseController.html Doc. Documentation
  Accessible without login HTML file source-class-Define.Core.BaseDAO.html Doc. Documentation
  Accessible without login HTML file source-class-Define.Core.BaseModel.html Doc. Documentation
  Accessible without login HTML file source-class-Defin...re.BaseService.html Doc. Documentation
  Accessible without login HTML file source-class-Define.Core.Framework.html Doc. Documentation
  Accessible without login HTML file source-class-Define.Core.IBaseDAO.html Doc. Documentation
  Accessible without login HTML file source-class-Define.Core.IBaseModel.html Doc. Documentation
  Accessible without login HTML file source-class-Defin...e.IBaseService.html Doc. Documentation
  Accessible without login HTML file source-class-Define.Core.IDefine.html Doc. Documentation
  Accessible without login HTML file source-class-Define.Core.IRouter.html Doc. Documentation
  Accessible without login HTML file source-class-Define.Core.IView.html Doc. Documentation
  Accessible without login HTML file source-class-Defin...bjectContainer.html Doc. Documentation
  Accessible without login HTML file source-class-Define.Core.Router.html Doc. Documentation
  Accessible without login HTML file source-class-Define.Core.View.html Doc. Documentation
  Accessible without login HTML file source-class-Defin...s.DatabaseBean.html Doc. Documentation
  Accessible without login HTML file source-class-Defin...atabaseFactory.html Doc. Documentation
  Accessible without login HTML file source-class-Defin...vers.IDatabase.html Doc. Documentation
  Accessible without login HTML file source-class-Defin....MONGODBDriver.html Doc. Documentation
  Accessible without login HTML file source-class-Defin...rs.MSSQLDriver.html Doc. Documentation
  Accessible without login HTML file source-class-Defin...rs.MYSQLDriver.html Doc. Documentation
  Accessible without login HTML file source-class-Defin...s.MYSQLIDriver.html Doc. Documentation
  Accessible without login HTML file source-class-Defin...s.ORACLEDriver.html Doc. Documentation
  Accessible without login HTML file source-class-Defin...vers.PDODriver.html Doc. Documentation
  Accessible without login HTML file source-class-Defin....POSTGREDriver.html Doc. Documentation
  Accessible without login HTML file source-class-Defin...s.SQLITEDriver.html Doc. Documentation
  Accessible without login HTML file source-class-Defin...FoundException.html Doc. Documentation
  Accessible without login HTML file source-class-Defin...eworkException.html Doc. Documentation
  Accessible without login HTML file source-class-Defin...ons.IException.html Doc. Documentation
  Accessible without login HTML file source-class-Defin...oggerException.html Doc. Documentation
  Accessible without login HTML file source-class-Defin...interException.html Doc. Documentation
  Accessible without login HTML file source-class-Defin...ntimeException.html Doc. Documentation
  Accessible without login HTML file source-class-Defin...PasswordHelper.html Doc. Documentation
  Accessible without login HTML file source-class-Defin...SingletonTrait.html Doc. Documentation
  Accessible without login HTML file source-class-Defin...ceptionHandler.html Doc. Documentation
  Accessible without login HTML file source-class-Defin...ies.IUtilities.html Doc. Documentation
  Accessible without login HTML file source-class-Defin...s.Localization.html Doc. Documentation
  Accessible without login HTML file source-class-Defin...ilities.Logger.html Doc. Documentation
  Accessible without login HTML file source-class-Defin...lities.Session.html Doc. Documentation
  Accessible without login HTML file source-class-PHPMailer.html Doc. Documentation
  Accessible without login HTML file source-class-phpmailerException.html Doc. Documentation
  Accessible without login HTML file source-class-SMTP.html Doc. Documentation
  Accessible without login HTML file source-function-__autoload.html Doc. Documentation

  Files folder image Files  /  docs  /  resources  
File Role Description
  Accessible without login Image file collapsed.png Icon Icon image
  Accessible without login Plain text file combined.js Data Auxiliary data
  Accessible without login Image file footer.png Data Auxiliary data
  Accessible without login Image file inherit.png Icon Icon image
  Accessible without login Image file resize.png Icon Icon image
  Accessible without login Image file sort.png Icon Icon image
  Accessible without login Plain text file style.css Data Auxiliary data
  Accessible without login Image file tree-cleaner.png Icon Icon image
  Accessible without login Image file tree-hasnext.png Icon Icon image
  Accessible without login Image file tree-last.png Data Auxiliary data
  Accessible without login Image file tree-vertical.png Icon Icon image

  Files folder image Files  /  lib  
File Role Description
Files folder imagedefine (6 directories)
Files folder imagevendors (1 directory)

  Files folder image Files  /  lib  /  define  
File Role Description
Files folder imagecore (14 files)
Files folder imagedbdrivers (11 files)
Files folder imageexceptions (6 files)
Files folder imagehelpers (1 file)
Files folder imagetraits (1 file)
Files folder imageutilities (8 files)

  Files folder image Files  /  lib  /  define  /  core  
File Role Description
  Plain text file BaseController.php Class Class source
  Plain text file BaseDAO.php Class Class source
  Plain text file BaseModel.php Class Class source
  Plain text file BaseService.php Class Class source
  Plain text file Framework.php Class Class source
  Plain text file IBaseDAO.php Class Class source
  Plain text file IBaseModel.php Class Class source
  Plain text file IBaseService.php Class Class source
  Plain text file IDefine.php Class Class source
  Plain text file IRouter.php Class Class source
  Plain text file IView.php Class Class source
  Plain text file ObjectContainer.php Class Class source
  Plain text file Router.php Class Class source
  Plain text file View.php Class Class source

  Files folder image Files  /  lib  /  define  /  dbdrivers  
File Role Description
  Plain text file DatabaseBean.php Class Class source
  Plain text file DatabaseFactory.php Class Class source
  Plain text file IDatabase.php Class Class source
  Plain text file MONGODBDriver.php Class Class source
  Plain text file MSSQLDriver.php Class Class source
  Plain text file MYSQLDriver.php Class Class source
  Plain text file MYSQLIDriver.php Class Class source
  Plain text file ORACLEDriver.php Class Class source
  Plain text file PDODriver.php Class Class source
  Plain text file POSTGREDriver.php Class Class source
  Plain text file SQLITEDriver.php Class Class source

  Files folder image Files  /  lib  /  define  /  exceptions  
File Role Description
  Plain text file FileNotFoundException.php Class Class source
  Plain text file FrameworkException.php Class Class source
  Plain text file IException.php Class Class source
  Plain text file LoggerException.php Class Class source
  Plain text file NullPointerException.php Class Class source
  Plain text file RuntimeException.php Class Class source

  Files folder image Files  /  lib  /  define  /  helpers  
File Role Description
  Accessible without login Plain text file .gitignore Data Auxiliary data

  Files folder image Files  /  lib  /  define  /  traits  
File Role Description
  Plain text file SingletonTrait.php Class Class source

  Files folder image Files  /  lib  /  define  /  utilities  
File Role Description
  Accessible without login Plain text file ErrorCodes.inc Data Auxiliary data
  Plain text file ErrorExceptionHandler.php Class Class source
  Accessible without login Plain text file ExceptionCodes.inc Data Auxiliary data
  Plain text file IUtilities.php Class Class source
  Plain text file Localization.php Class Class source
  Plain text file Logger.php Class Class source
  Plain text file PasswordHelper.php Class Class source
  Plain text file Session.php Class Class source

  Files folder image Files  /  lib  /  vendors  
File Role Description
Files folder imagephpmailer (2 files)

  Files folder image Files  /  lib  /  vendors  /  phpmailer  
File Role Description
  Plain text file PHPMailer.php Class Class source
  Plain text file SMTP.php Class Class source

  Files folder image Files  /  logs  
File Role Description
  Accessible without login Plain text file error.log Data Auxiliary data

 Version Control Unique User Downloads Download Rankings  
 100%
Total:261
This week:0
All time:7,674
This week:336Up

For more information send a message to info at phpclasses dot org.