This commit is contained in:
Jordy van Zeeland 2024-08-16 09:08:07 +02:00
parent 2400f8bd21
commit ddd1fbdbd3
8 changed files with 17 additions and 9 deletions

View File

@ -1,8 +1,13 @@
<?php <?php
use sealandia\framework\Template;
use Framework\Template;
class Welcome{ class Welcome{
/**
* Show the application welcome page.
*/
public function index(){ public function index(){
$template = new Template(); $template = new Template();
return $template->render('welcome', []); return $template->render('welcome', []);

View File

@ -1,8 +1,8 @@
{ {
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"sealandia\\": "./", "App\\": "app/",
"sealandia\\framework\\": "framework/" "Framework\\": "framework/"
} }
}, },
"require": { "require": {

View File

@ -1,5 +1,7 @@
<?php <?php
namespace Framework;
use PDO; use PDO;
class Auth{ class Auth{

View File

@ -1,5 +1,7 @@
<?php <?php
namespace Framework;
use PDO; use PDO;
Class Database{ Class Database{

View File

@ -1,6 +1,6 @@
<?php <?php
namespace sealandia\framework; namespace Framework;
class Router{ class Router{
@ -29,11 +29,10 @@ class Router{
if(array_key_exists($this->uri, $routes)){ if(array_key_exists($this->uri, $routes)){
list($controller, $method) = explode('@', $routes[$this->uri]); list($controller, $method) = explode('@', $routes[$this->uri]);
$controllerPath = __DIR__ . '/../app/controllers/' . $controller . '.php'; $controllerPath = __DIR__ . '/../app/controllers/' . $controller . '.php';
if(file_exists($controllerPath)){ if(file_exists($controllerPath)){
require_once $controllerPath; require $controllerPath;
$controller = new $controller(); $controller = new $controller();
if(method_exists($controller, $method)){ if(method_exists($controller, $method)){

View File

@ -1,6 +1,6 @@
<?php <?php
namespace sealandia\framework; namespace Framework;
class Template{ class Template{

View File

@ -1,6 +1,6 @@
<?php <?php
namespace sealandia; namespace Sealandia;
session_start(); session_start();

View File

@ -1,6 +1,6 @@
<?php <?php
use sealandia\framework\Router; use Framework\Router;
$routes = [ $routes = [
'/' => 'Welcome@index', '/' => 'Welcome@index',