The basic Model-View-Controller template for your php projects.
foreach (glob(DIR . '/mvc/*.php') as $mvcFile){
require $mvcFile;
}
Route::run('/example', '/example/example@index', 'get|post');
class example extends Controller {
public function index() {
$this->view('example/example-view.php', [
'data' => 'Hello World!'
]);
}
}
<?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>