diff --git a/app/controllers/Controller.php b/app/controllers/Controller.php new file mode 100644 index 0000000..4e65c53 --- /dev/null +++ b/app/controllers/Controller.php @@ -0,0 +1,17 @@ + render($view,$data); + } +} \ No newline at end of file diff --git a/app/controllers/HomeController.php b/app/controllers/HomeController.php index ffe55a9..9ee3ac5 100644 --- a/app/controllers/HomeController.php +++ b/app/controllers/HomeController.php @@ -2,5 +2,7 @@ namespace app\controllers; class HomeController{ - + public function index(){ + return Controller::view("home"); + } } \ No newline at end of file diff --git a/app/controllers/LoginController.php b/app/controllers/LoginController.php index 7f6c4ab..852ad9b 100644 --- a/app/controllers/LoginController.php +++ b/app/controllers/LoginController.php @@ -2,5 +2,11 @@ namespace app\controllers; class LoginController{ + public function index(){ + return Controller::view("login"); + } + public function store(){ + var_dump('store do login'); + } } \ No newline at end of file diff --git a/app/views/home.php b/app/views/home.php new file mode 100644 index 0000000..051837c --- /dev/null +++ b/app/views/home.php @@ -0,0 +1,3 @@ +layout("master");?> + +

Home

diff --git a/app/views/login.php b/app/views/login.php new file mode 100644 index 0000000..feb54ca --- /dev/null +++ b/app/views/login.php @@ -0,0 +1,3 @@ +layout("master");?> + +

Login

\ No newline at end of file diff --git a/app/views/master.php b/app/views/master.php new file mode 100644 index 0000000..c6b6c1f --- /dev/null +++ b/app/views/master.php @@ -0,0 +1,11 @@ + + + + + + Document + + + section('content')?> + + \ No newline at end of file diff --git a/composer.json b/composer.json index 4b4d7b9..4349945 100644 --- a/composer.json +++ b/composer.json @@ -11,5 +11,7 @@ "email": "resilvajr@hotmail.com" } ], - "require": {} + "require": { + "league/plates": "^3.5" + } } diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..cff1e85 --- /dev/null +++ b/composer.lock @@ -0,0 +1,83 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "0ae27c55eae141acc77e7a2bc0bb042f", + "packages": [ + { + "name": "league/plates", + "version": "v3.5.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/plates.git", + "reference": "a6a3238e46c6e19af7318fdc36bfbe49b0620231" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/plates/zipball/a6a3238e46c6e19af7318fdc36bfbe49b0620231", + "reference": "a6a3238e46c6e19af7318fdc36bfbe49b0620231", + "shasum": "" + }, + "require": { + "php": "^7.0|^8.0" + }, + "require-dev": { + "mikey179/vfsstream": "^1.6", + "phpunit/phpunit": "^9.5", + "squizlabs/php_codesniffer": "^3.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Plates\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jonathan Reinink", + "email": "jonathan@reinink.ca", + "role": "Developer" + }, + { + "name": "RJ Garcia", + "email": "ragboyjr@icloud.com", + "role": "Developer" + } + ], + "description": "Plates, the native PHP template system that's fast, easy to use and easy to extend.", + "homepage": "https://platesphp.com", + "keywords": [ + "league", + "package", + "templates", + "templating", + "views" + ], + "support": { + "issues": "https://github.com/thephpleague/plates/issues", + "source": "https://github.com/thephpleague/plates/tree/v3.5.0" + }, + "time": "2023-01-16T20:25:45+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [], + "plugin-api-version": "2.3.0" +} diff --git a/config/rotas.php b/config/rotas.php deleted file mode 100644 index 5acd078..0000000 --- a/config/rotas.php +++ /dev/null @@ -1,19 +0,0 @@ -[ - "/"=> load("HomeController","index"), - "/login" => load("LoginController","index") - ], - "POST"=>[ - "contato" => load("ContatoController","store") - ] -]; diff --git a/index.php b/index.php index 575a7bf..62de928 100644 --- a/index.php +++ b/index.php @@ -1,6 +1,28 @@ getMessage(); +} //header("Access-Control_Allow_Origin: *"); //header("Access-Control-Allow-Credentials: true"); diff --git a/routes/router.php b/routes/router.php new file mode 100644 index 0000000..c0d69c3 --- /dev/null +++ b/routes/router.php @@ -0,0 +1,30 @@ +$action(); + }catch(Exception $e){ + echo $e->getMessage(); + } +} + +$router= [ + "GET"=>[ + "/projeto/api_educa/"=> fn()=> load("HomeController","index"), + "/projeto/api_educa/login" => fn()=> load("LoginController","index") + ], + "POST"=>[ + "/projeto/api_educa/login" => fn()=> load("LoginController","store") + ] +];