LittleFram – my new PHP framework

Today I have developed a simple php framework. I'm going to use it for my new project. Also, I will improve it with new features in the next weeks.

LittleFram has only 5 kb and it is very intuitive.

You can easily create new controllers, views files, models, layouts and routes.

There is a simple LittleFram's controller:


class Main extends Controller{
function __construct()
{
parent::__construct(); // this function will connect the controller with the view file
$this->view->layout = "layout"; // you can set up an layout for each controller
$this->model = new Model(); // here I have connected my model class to this controller
}
public function index() // here is the index action
{
$this->model->getModel("Data"); // this code will get model Data
$data = new Data();
$data->run(); // this code will run a function from my model
$this->view->render("index"); // this code will render the view file
}
}

I have used the PDO database driver for my models.

There is a view model:


$skeleton->title = "A new title";

You can add an array in your controller like this:

$this->view->render("index", array("info"=>"Hello worls"));

To display it on view files, you must only use

echo $get["info"];









Leave a Comment