- Handle get/post easily
- Model Supports - Create, Read, Update, Delete and where clause.
- Easlly load views from controller
- Light Weight
- Doesn't contain fancy features that you don't use anyways.
Just clone this repository
git clone https://github.com/Chaitya62/CJ-MVC.git
OR
Download it and place it in the htdocs
equivalent of your server.
Edit the database.php
inside config folder to connect it to your sql database.
The MVC follows a CodeIgniter like url structure.
For Example In the following url http://localhost/CJ-MVC/index.php/User/get/2/
CJ-MVC
is the project nameindex.php
is compulsory for now as it is the entry point to the appUser
is the name of the Controllerget
is the function you want- rest is passed as arguments to the function
Note
As the function name is get_get
and not get
the _get means that want this function to handle the get requests.
To create your own controller just copy the Test.php
file in the controller directory and build upon it.
require_once(__DIR__.'/../model/TestModel.php');
replace this line with your model if you have any or remove it.
also replace the constructor accordingly
To create your own model copy the TestModel.php
file in the models directory.
For further examples on using model see the usage in User.php
To create your own view just create simple php views and load it using load_view
function in the controller
$this->load_view('<view name>', <associative array for variables you need in the view>)
That's it you are ready to roll and create the next best site.
An app created using this framework demo github
For more details on how the framework works go through the given example files in
controller
,model
andview
folders.
Here is a blog post explaining this in detail.
This framework is in the very early stages of it's development.
You can help me by posting issues.
or write me at [email protected]