2017 © Pedro Peláez
 

library my-mvc

image

njcannington/my-mvc

  • Friday, June 1, 2018
  • by njcannington
  • Repository
  • 1 Watchers
  • 1 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 2 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Custom MVC

In order to gain a better understanding of how the MVC framework operates. I wanted to build one from scratch., (*1)

Usage

Routing

Within the web/index.php file, all routing is handled with $route->add(). You just need to specify the uri, controller, and action., (*2)

eg: $route->add("/", "index", "index"), (*3)

This ensures the home page is routed to the IndexController and returns the indexAction method., (*4)

Controllers

All controllers should stored in the App\Controllers namespace (and directory), using the syntax {Uppercasename}Controller (eg. IndexController). However the file itself should be all lowercase (eg. indexcontroller.php), (*5)

The action within the controller uses the syntax {lowercasename}Action (eg. indexAction), (*6)

Views

Set the view within an action using setView() method. (eg. $this->setView("/login"))). All view files are lowercase and stored in the app\views directory., (*7)

Setup

Tested with:

  1. PHP 5.6 - PHP 7.2
  2. Apache 2.4.*
    • needed modules:
      • mod_rewrite
    • set AllowOverride to All
    • point the DocumentRoot to the /web directory within project
  3. MySQL 5.7.20

The Versions

01/06 2018

dev-master

9999999-dev

  Sources   Download

01/06 2018

dev-refactor

dev-refactor

  Sources   Download

24/05 2018

v0.0.1

0.0.1.0

  Sources   Download