a tiny framework for php
This README would normally document whatever steps are necessary to get nCore up and running.
- Share nCore framework code
- nCore is a tiny framework that allows you to quickly write simple web site
- nCore is inspired from Laravel using slim framework as a library and AltoRouter combined with another one as PHP router .
- Version 0.1
- PHP router
- MVC architecture
- Framework structure similar to laravel concept
- Template Engine
- Doctrine ORM
- Error handling
Download source code , then use composer to install required projects
$ composer install
the routes.php file contains : `
$collection = new RouteCollection();
$collection->attachRoute(new Route('/hello', array(
'_controller' => 'testController::index',
'methods' => 'GET'
)));
$router = new Router($collection);
$router->setBasePath('/');
$route = $router->matchCurrentRequest();
ErrorHandling::error_404($route);
which means that if you request : HOST/public/hello , it will be routed to testController and calling the function index() .
the function index() contains :
hello::render();
The controller is calling the view to render the content .
our render function contains
/* display header */
$tpl = new Template(hello::$template);
$tpl->display('header.ncore.php');
/* display body */
$body = new Template(hello::$template);
$body->display('body.ncore.php');
/* display footer */
$footer = new Template(hello::$template);
$footer->display('footer.ncore.php');
we create our template , and render the header , body and footer . The header.ncore.php contains html and php code .
- Hamza Bourrahim