Skip to content

wjlee2020/mymvc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MyMVC Framework

This was my first time creating an mvc framework. I come from frontend/js (React) background and so it was a great challenge learning Class/OOP and the MVC framework. I'm sure I have a lot more to edit and refactor.

HTACCESS

These files help coordinate urls.
Go into the public folder -> .htaccess.
Line 4 should be changed to your local url.
Basically, these .htaccess files help us route us into the public index.php file.

App > config

Go into the App > config file and change the necessary named constants.
These named constants should correspond w/ your local environment.

Core.php

This basically creates our urls and loads our controllers.
The contructor will run the getUrl() which returns us a nicely trimmed, 'exploded' url.
By getting back the url, the constructor will fetch (require_once) the url's controller.
As the url returned is an array (explode returns an array), the 1st index will contain the params for the method.

Classes

This includes the autoload_register so that we can instantiate classes (or extend them)

Controllers

Don't forget to include a public function index() {} method into your controller classes.
In the Core.php, the $currentMethod is set to 'index'. If you are on your localhost/app root, you will get an error without this index method inside your newly created controller.

About

PHP MVC framework

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages