kmvc
Categories
Component ID
Component name
Component type
Maintenance status
Development status
Component security advisory coverage
Component created
Component changed
Component body
kmvc is a micro MVC framework that have a convention over confiugration approach which will save you from registering urls for different actions you want to create in Drupal and it will provide you an object oriented approach to handle your module.
It attaches itself to the menu_hook and create custom on the fly routes for the controller classes you have defined in your library.
It's completely Object Oriented and provides a very simple structure for developers new to the Drupal. You have to define some small configurations in your .module file which are pretty easy and you will be ready to go in no time.
It does not override the current routing of Drupal but it comes around right before a 404.
Usage of Controllers and Actions are similar to the Zend Framework, where each controller should be defined with a Controller suffix and each action should have an Action suffix. These classes should be managed in an app and controllers folders. It has a support for modules too where controllers can be grouped into modules.
It's also recommended to use a library folder where you can put the external libraries (I don't currently know if this is supported by libraries module or not.) External library classes are also autoloaded based on Zend Framework Coding Standards. You don't need to use require_once or things like that in order to include your controllers (and libraries).
There is ModelView layer containing a very simple view architecture. Arguments can be added from the actions, they can be used on the conventional action templates. Views are put inside a views folder. Each controller should have it's own directory containing .phtml extended files for every action. For a MusicController that have an playAction, view file should be: module-app/views/music/play.phtml.
kmvc does not provide a Model layer and currently there is no plan to add that. Node API should be used to mimic models. They can be wrapped in a Service layer and/or DAOs to provide a wrapper interface to existing Drupal Node API to abstract the data access from core Drupal functions.
There is an App class which you should use in order to initialize your application by using a very simple addApp() method. It should contain some options to initialize of course. You can see the options in action and documented as best as possible on the sample apps.
Namespaces are not only supported but also encouraged (and if you want to create modules a must) for controllers, modules and libraries.
This module also comes with two sub-modules where you can see the module in action used by different modules, proving multiple apps can be enabled at the same time using kmvc module.
Suggestions are welcome and will be recorded and tracked using issues.
This module requires a PHP 5.3 environment as namespaces are encouraged and closure functions are used occasionally.
You can also use the github mirror: https://github.com/radalin/kmvc
