Skip to content

FatihElmas/MVC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Basic MVC System for PHP Programming Language

The basic Model-View-Controller template for your php projects.

Usage

index.php

    foreach (glob(DIR . '/mvc/*.php') as $mvcFile){
        require $mvcFile;
    }
    Route::run('/example', '/example/example@index', 'get|post');

Controller/example/example.php

class example extends Controller {
    public function index() {

        $this->view('example/example-view.php', [
            'data' => 'Hello World!'
        ]);
    }
}

View/example/example-view.php

<?php

    echo $data; // Output should be 'Hello World' because we sent data from controller/example/example.php file
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Example Page</title>
</head>
<body>

</body>

</html>

Releases

No releases published

Packages

No packages published

Languages