|
8 years ago | |
---|---|---|
app | 8 years ago | |
assets | 8 years ago | |
docs | 8 years ago | |
sys | 8 years ago | |
tests | 8 years ago | |
.gitignore | 8 years ago | |
.gitmodules | 8 years ago | |
README.md | 8 years ago | |
index.php | 8 years ago | |
phpdoc.dist.xml | 8 years ago |
miniMVC is a minimalistic Modular MVC framework, with built-in minifier, and pure-PHP templating system.
Database class uses Query as a database abstraction layer and query builder.
Database connections are set in /app/config/db.php
index.php - framework bootstrap
app - configuration and app-wide files
assets - frontend files
sys - core framework classes
Creating a controller
<?php
class Foo extends miniMVC\Controller {
function __construct()
{
parent::__construct();
}
}
Creating a model
<?php
class Bar extends miniMVC\Model {
function __construct()
{
parent::__construct();
}
}
Loading a database
$this->db = miniMVC\db::get_instance($db_name);
Note that multiple databases can be used in the same class by specifying a different database name.
Loading a model (From a controller)
$this->load_model($model)
- creates an instance of that model as a member of the current class. After loading the model, you can call its methods like so
$this->[model name]->method()
Loading a class
Librarys / classes found in app/classes
or sys/libraries
are autoloaded.
To call a library, simply instantiate that class.
Classes with a get_instance
static methods should be called like so:
$obj =& miniMVC\class::get_instance()
Other classes should be called using the new operator
$obj = new miniMVC\class()