Download the PHP package shafiul-islam/nmvc without Composer
On this page you can find all versions of the php package shafiul-islam/nmvc. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package nmvc
NMVC
NMVC is a PHP base MVC framework
Installation
The NMVC can be installed with Composer.
Run Your Project
By using PHP Built-in web server you can run your project easily
you can change the port if you need
Directory Structure
The Basics
Routing
All route files are defined in app/routes
directory
Web Routing
routes/web.php
used for defines routes for application's interface.
here is a basic structure of web.php
the most basic routing is closure aproch. it has 2 arguments. route uri as a string and a closure.
this route will work as a index page. example: http://example.com/
for http://example.com/hello
Router class ($app->router
) has 2 methods right now. GET
, and POST
.
POST route can be create by useing
route medthods also accept contoller as a callback argument. we can pass a array where 0 index will be the calss name, and 1 index will be the function name
also we can we can define a view directly
API Routing
coming soon
controller
base controller class
it will hold all you code and functions.
for routing functions take a request argument and must have a request method condition.
here $this->view('index',$data);
render you view files. it takes 2 argument first one is you view file and second one is data that you are going to pass to your view file.
view argument is basically a php file name inside a views
directory without .php
extension.
data
argument is an associative array and for each value you will get a php variable inside you view.
like if i pass
ill get hello
key ass my variable$hello
inside my view
inside data
you can pass your page/view metadata also.
if you not set any metadata it will take all the info from config file as default .
NMVC CLI
NMVC ClI will make your development process much easier and faster. its a build in tool. you can crete controller,model, make migration by using cmd command.
run php nmvc