Skip to content
/ define-mvc Public template
forked from niteshapte/define-mvc

A Front Controller based PHP MVC framework

License

Notifications You must be signed in to change notification settings

informaticacba/define-mvc

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:



class UserController extends ApplicationController {
	public function profileAction($param1, $param2) {
		// logic goes here
	}
}

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:


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

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


echo $msg

** 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.

About

A Front Controller based PHP MVC framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 97.0%
  • C++ 2.1%
  • ApacheConf 0.9%