Skip to content

Commit

Permalink
New update and changes
Browse files Browse the repository at this point in the history
  • Loading branch information
peterujah committed Feb 17, 2024
1 parent 6c0e01b commit 3389787
Show file tree
Hide file tree
Showing 60 changed files with 1,689 additions and 639 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
* @license See LICENSE file
*/
namespace App\Controllers\Config;
use Luminova\Config\Configuration;

class MyConfiguration extends Configuration{
use Luminova\Config\Configuration;

class Config extends Configuration
{
}
6 changes: 4 additions & 2 deletions samples/MyFunctions.php → app/Controllers/Utils/Func.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
* @license See LICENSE file
*/
namespace App\Controllers;
use Luminova\Functions\Functions;

class MyFunctions extends Functions{
use \Luminova\Base\BaseFunction;

class Func extends BaseFunction
{

}
6 changes: 6 additions & 0 deletions app/Controllers/Utils/Global.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php
/**
* This goal file allows you to define your own custom functions
* or overwrite core procedural functions to replace them with your own.
* This file is loaded during the bootstrap process and is called during the framework's execution.
*/
12 changes: 6 additions & 6 deletions app/Controllers/Welcome.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
*/
namespace App\Controllers;

use Luminova\Base\BaseController;
use Luminova\Config\Configuration;
use Luminova\Base\BaseViewController;
use Luminova\Base\BaseConfig;

class Welcome extends BaseController
class Welcome extends BaseViewController
{

public function page(): void
{
$this->app->render("index")->view();
$this->app()->render("index")->view();
}

public function info(): void
Expand All @@ -27,8 +27,8 @@ public function info(): void
"error" => [
"status" => "OK",
"code" => 200,
"version" => Configuration::version(),
"framework" => Configuration::copyright(),
"version" => BaseConfig::version(),
"framework" => BaseConfig::copyright(),
//"details" => "The endpoint [" . $this->getView() . "] you are trying to access does not exist.",
"timestamp" => date("Y-m-d H:i:s")
]
Expand Down
16 changes: 11 additions & 5 deletions bootstrap/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

use \App\Controllers\Application;


/**
* Set the custom error handler for non-fatal errors
*/
Expand All @@ -24,11 +23,18 @@
register_shutdown_function(['\Luminova\Errors\Error', 'shutdown']);

/*
* Load global developer file
* Require system Common.php
*/
if (!defined('APP_COMMON')) {
include_once __DIR__ . '/../system/Functions/Common.php';
}

/*
* Require application Global.php file if exists.
*/
$global = __DIR__ . '/../app/Controllers/Global.php';
if(file_exists($global)){
include_once $global;
$global24 = __DIR__ . '/../app/Controllers/Utils/Global.php';
if(file_exists($global24)){
include_once $global24;
}

/*
Expand Down
13 changes: 3 additions & 10 deletions public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,9 @@
* bootstraps the router and set the error handler based on context
*/
$app->router->bootstraps(
new Bootstrap(Bootstrap::WEB, function($router) use ($app) {
require __DIR__ . '/../routes/web.php';
},
$webErrorHandler),
new Bootstrap(Bootstrap::API, function($router) use ($app) {
require __DIR__ . '/../routes/api.php';
}, $apiErrorHandler),
new Bootstrap(Bootstrap::CLI, function($router) use ($app){
require __DIR__ . '/../routes/cli.php';
})
new Bootstrap(Bootstrap::WEB, $app, $webErrorHandler),
new Bootstrap(Bootstrap::API, $app, $apiErrorHandler),
new Bootstrap(Bootstrap::CLI, $app)
);

/*
Expand Down
2 changes: 1 addition & 1 deletion samples/.env
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
app.name = Luminova
app.hostname = luminova.com
app.base.url = https://luminova.com
app.base.www.url = https://wwwluminova.com
app.base.www.url = https://www.luminova.com
app.timezone = UTC
;app.developer = Nanoblock Technology
# [production and development]
Expand Down
17 changes: 17 additions & 0 deletions samples/Config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
/**
* Luminova Framework
*
* @package Luminova
* @author Ujah Chigozie Peter
* @copyright (c) Nanoblock Technology Ltd
* @license See LICENSE file
*/
namespace App\Controllers\Config;

use \Luminova\Base\BaseConfig;

class Config extends BaseConfig
{

}
17 changes: 17 additions & 0 deletions samples/Func.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
/**
* Luminova Framework
*
* @package Luminova
* @author Ujah Chigozie Peter
* @copyright (c) Nanoblock Technology Ltd
* @license See LICENSE file
*/
namespace App\Controllers;

use \Luminova\Base\BaseFunction;

class Func extends BaseFunction
{

}
16 changes: 8 additions & 8 deletions samples/Home.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
*/
namespace App\Controllers;

use Luminova\Base\BaseController;
use \Luminova\Base\BaseViewController;

class Home extends BaseViewController
{
/** @var \ Luminova\Http\Request $this->request() */
/** @var \ Luminova\Application $this->app() */
/** @var \Luminova\Security\InputValidator $this->validate() */

class Home extends BaseController {
/**
* Extending Luminova\Controller; in your controller
* You will have access for request and validation class instance
*/

public function page(): void
{
$this->app->render("index")->view();
$this->app()->render("index")->view();
}
}
3 changes: 2 additions & 1 deletion samples/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

namespace App\Controllers\Config;

class Session {
class Session
{
/**
* The name of the session cookie.
* @var string $cookieName;
Expand Down
3 changes: 2 additions & 1 deletion samples/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
*/
namespace App\Controllers\Config;

class Template {
class Template
{
/**
* Application template engine
*
Expand Down
8 changes: 7 additions & 1 deletion samples/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
* @license See LICENSE file
*/
namespace App\Controllers;
use Luminova\Base\BaseController;

use \Luminova\Base\BaseController;
use App\Controllers\Models\UserModel;

class UserController extends BaseController
Expand All @@ -17,4 +18,9 @@ class UserController extends BaseController
/** @var \ Luminova\Application $this->app */
/** @var \Luminova\Security\InputValidator $this->validate */


public function page(): void
{
$this->app->render("index")->view();
}
}
3 changes: 2 additions & 1 deletion samples/UserModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
* @license See LICENSE file
*/
namespace App\Controllers\Models;
use Luminova\Base\BaseModel;

use \Luminova\Base\BaseModel;

class UserModel extends BaseModel
{
Expand Down
8 changes: 4 additions & 4 deletions system/Application/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use Luminova\Routing\Router;
use Luminova\Config\DotEnv;
use Luminova\Template\Template;
use Luminova\Config\Configuration;
use Luminova\Base\BaseConfig;
use App\Controllers\Config\Template as TemplateConfig;

class Application {
Expand All @@ -35,7 +35,7 @@ class Application {
*
* @var Router
*/
public $router;
public ?Router $router = null;

/**
* Initialize the base application constructor
Expand All @@ -44,12 +44,12 @@ class Application {
*/
public function __construct(string $dir = __DIR__) {
// Register dotenv variables
DotEnv::register(Configuration::getRootDirectory($dir) . DIRECTORY_SEPARATOR . '.env');
DotEnv::register(BaseConfig::root($dir, '.env'));

/*
* Register The Application Timezone
*/
date_default_timezone_set(Configuration::getVariables("app.timezone", 'UTC'));
date_default_timezone_set(BaseConfig::getString("app.timezone", 'UTC'));

// Initialize the router instance
$this->router = new Router();
Expand Down
Loading

0 comments on commit 3389787

Please sign in to comment.