GithubHelp home page GithubHelp logo

informaticacba / define-mvc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from niteshapte/define-mvc

1.0 0.0 0.0 399 KB

A Front Controller based PHP MVC framework

License: GNU General Public License v3.0

PHP 96.96% C++ 2.15% ApacheConf 0.90%

define-mvc's Introduction

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.

define-mvc's People

Contributors

niteshapte avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.