This is a base template intended to help you create your own Kohana 3 Module.
Is important to understand that most modules won't need models, controlers, views, etc... since this is a Module Template to learn about what you can do with Kohana. I think that for newbies It's easier to delete what you don't need that to write from scratch what you need... so feel free to play, delete, add anything you want.
The intention is not to provide with a fix structure of how a module should be, but to provide an start point for your our custom modules.
Important: You could delete everything and only keep one file is that is what you need.
To use this Kohana Module Template, just:
- Download and extract the code from Github.
- Place the module into your Kohana instances modules folder.
- Enable the module within the application bootstrap within the section entitled
modules
.
Go to application/bootstrap.php
, look for Kohana::modules()
and add:
'modulename' => MODPATH.'kohana-module-template', // Module Name & Path can be diferent if you like
Example:
Kohana::modules(array(
// 'auth' => MODPATH.'auth', // Basic authentication
// 'cache' => MODPATH.'cache', // Caching with multiple backends
// 'codebench' => MODPATH.'codebench', // Benchmarking tool
// 'database' => MODPATH.'database', // Database access
// 'image' => MODPATH.'image', // Image manipulation
// 'orm' => MODPATH.'orm', // Object Relationship Mapping
// 'unittest' => MODPATH.'unittest', // Unit testing
// 'userguide' => MODPATH.'userguide', // User guide and API documentation
'modulename' => MODPATH.'kohana-module-template', // Add Module Name & Path
));
Replace 'modulename' and 'kohana-module-template' for your own name & path respectably.
To see a Demo of the Module working go to http://kohana.sebicas.com/modulename
Here is a list of articles I found about how to write your own Modules in Kohana 3
- Fork it.
- Create a branch (
git checkout -b my_markup
) - Commit your changes (
git commit -am "Added Snarkdown"
) - Push to the branch (
git push origin my_markup
) - Create an [Issue][1] with a link to your branch
- Enjoy a refreshing orange juice and wait
Thanks to the following colaborators:
In the near future, additional support for the following methods will be included.
- Jelly-style driver configuration