-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollback to before dropping the core folder and change middleware class name of auth to Authentication
- Loading branch information
1 parent
69ccde8
commit 788e008
Showing
48 changed files
with
2,852 additions
and
63 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
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?php | ||
|
||
use UnknownRori\UnknownRoriPHPCore\Http\Route; | ||
use Core\Support\Http\Route; | ||
|
||
Route::get('/', function () { | ||
return view("welcome"); | ||
})->name('home'); | ||
})->name('home')->middleware('auth'); |
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,7 +1,7 @@ | ||
#!php | ||
<?php | ||
|
||
use UnknownRori\UnknownRoriPHPCore\Console\CLI; | ||
use Core\Console\CLI; | ||
|
||
require_once('server.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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace Core; | ||
|
||
interface IKernel | ||
{ | ||
public static function Start(); | ||
} |
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,61 @@ | ||
<?php | ||
|
||
namespace Core; | ||
|
||
use Core\Support\Http\Middleware; | ||
use Core\Support\Http\Route; | ||
use Core\Support\Http\Request; | ||
use Core\Support\Session; | ||
use Dotenv\Dotenv; | ||
use Exception; | ||
|
||
/** | ||
* Kernel of UnknownRori PHP Framework | ||
*/ | ||
class Kernel implements IKernel | ||
{ | ||
protected $option = []; | ||
|
||
public function __construct() | ||
{ | ||
$this->option = require("{$_ENV['APP_DIR']}/config/kernel.php"); | ||
} | ||
|
||
/** | ||
* Starting point of the entire framework, | ||
* Request will be sent to this method and then to Route | ||
* @return Static|False | ||
*/ | ||
public static function Start() | ||
{ | ||
$App = new static; | ||
if (file_exists($_ENV['ROOT_PROJECT'] . '/.env')) { | ||
Dotenv::createImmutable($_ENV['ROOT_PROJECT'])->load(); | ||
} | ||
|
||
array_filter($App->option['ENV'], function ($value, $key) { | ||
$_ENV[$key] = $value; | ||
}, ARRAY_FILTER_USE_BOTH); | ||
|
||
set_exception_handler(function ($e) { | ||
echo "<pre style='{$_ENV["ERROR_STYLE"]}'>"; | ||
throw new Exception($e); | ||
echo '</pre>'; | ||
die; | ||
}); | ||
|
||
Session::start($App->option['session']); | ||
|
||
if (preg_match($App->option['regex'], $_SERVER["REQUEST_URI"])) { | ||
return false; | ||
} else { | ||
Middleware::RunAll('runtime'); | ||
|
||
Route::define("{$_ENV['APP_DIR']}/route/web.php")->Run("/" . Request::URI(), Request::Method()); | ||
|
||
Middleware::RunAll('runtime'); | ||
} | ||
|
||
return $App; | ||
} | ||
} |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 UnknownRori | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Oops, something went wrong.