-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4b8da33
commit 6eaf795
Showing
32 changed files
with
284 additions
and
240 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace App\Services; | ||
|
||
use System\Classes\Container; | ||
use System\Classes\Router; | ||
use System\Interfaces\ServiceInterface; | ||
|
||
class RouteService implements ServiceInterface | ||
{ | ||
protected $namespace = 'App\\Controllers\\'; | ||
|
||
public function register() | ||
{ | ||
$router = Container::get(Router::class); | ||
$router->setNamespace($this->namespace); | ||
|
||
$this->loadRoutes(); | ||
} | ||
|
||
protected function loadRoutes() | ||
{ | ||
require_once ROOT . 'app' . DS . 'routes.php'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
/* | ||
// This file is a part of K-MVC | ||
// version: 1.1.0 | ||
// author: MrKen | ||
// website: https://vdevs.net | ||
// github: https://github.com/buihanh2304/simple-php-mvc-framework | ||
// docs: https://github.com/buihanh2304/simple-php-mvc-framework/wiki | ||
*/ | ||
|
||
use App\Controllers\HomeController; | ||
use System\Classes\Container; | ||
use System\Classes\Router; | ||
use System\Classes\Template; | ||
|
||
/** @var Router */ | ||
$router = Container::get(Router::class); | ||
|
||
$router->add('/', 'HomeController@index'); | ||
|
||
$router->add('/home', function () { | ||
/** @var Template */ | ||
$view = Container::get(Template::class); | ||
|
||
return $view->render('home/main'); | ||
}); | ||
|
||
$router->add('/test/1', [HomeController::class, 'index']); | ||
$router->add('/test/2', [HomeController::class, 'index'], ['get']); | ||
$router->add('/api/test', function () { | ||
return [ | ||
'response' => 'ok', | ||
]; | ||
}); | ||
|
||
// exemple | ||
$router->add('/register', 'UserController@register', 'GET|POST'); | ||
$router->add('/#', 'UserController@login', 'GET|POST'); | ||
$router->add('/logout', 'UserController@logout', 'GET|POST'); |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,26 @@ | ||
{ | ||
"name": "buihanh2304/simple-php-mvc-framework", | ||
"description": "A simple PHP MVC Framework", | ||
"keywords": ["php", "mvc", "framework"], | ||
"keywords": [ | ||
"php", | ||
"mvc", | ||
"framework" | ||
], | ||
"license": "MIT", | ||
"config": { | ||
"sort-packages": true | ||
}, | ||
"require": { | ||
"php": "^8.0", | ||
"league/plates": "3.*" | ||
}, | ||
"autoload": { | ||
"files": [ | ||
"system/functions.php" | ||
], | ||
"psr-4": { | ||
"App\\": "app/", | ||
"System\\": "system/" | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.