-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Update README.md - Change PHPDoc - Change the DSS_PATH constant to SS_PATH - Introducing the Request class. Response and Request now separated and support new features
- Loading branch information
1 parent
61ce5aa
commit b79002e
Showing
19 changed files
with
318 additions
and
130 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# damnstupidsimple/core | ||
The core package for Damn Stupid Simple framework. This is a subtree split for [Damn Stupid Simple framework](https://github.com/damnstupidsimple/framework). | ||
# stupidlysimple/core | ||
The core package for StupidlySimple framework. This is a subtree split for [StupidlySimple framework](https://github.com/stupidlysimple/framework). | ||
Documentations are available on the main package. |
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,8 +1,8 @@ | ||
<?php | ||
/** | ||
* Damn Stupid Simple - A PHP Framework For Lazy Developers | ||
* StupidlySimple Framework - A PHP Framework For Lazy Developers | ||
* | ||
* Copyright (c) 2016 Studio Nexus | ||
* Copyright (c) 2017 Fariz Luqman | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a | ||
* copy of this software and associated documentation files (the "Software"), | ||
|
@@ -22,13 +22,14 @@ | |
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
* | ||
* @package Damn Stupid Simple | ||
* @author Studio Nexus <fariz@studionexus.co> | ||
* @copyright 2016 Studio Nexus | ||
* @license MIT | ||
* @version Release: 0.2.0 | ||
* @link https://www.studionexus.co/php/damnstupidsimple | ||
* @package StupidlySimple | ||
* @author Fariz Luqman <fariz[email protected]> | ||
* @copyright 2017 Fariz Luqman | ||
* @license MIT | ||
* @since 0.3.3 | ||
* @link https://stupidlysimple.github.io/ | ||
*/ | ||
|
||
namespace Core; | ||
|
||
/** | ||
|
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,8 +1,8 @@ | ||
<?php | ||
/** | ||
* Damn Stupid Simple - A PHP Framework For Lazy Developers | ||
* StupidlySimple Framework - A PHP Framework For Lazy Developers | ||
* | ||
* Copyright (c) 2016 Studio Nexus | ||
* Copyright (c) 2017 Fariz Luqman | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a | ||
* copy of this software and associated documentation files (the "Software"), | ||
|
@@ -22,12 +22,12 @@ | |
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
* | ||
* @package Damn Stupid Simple | ||
* @author Studio Nexus <fariz@studionexus.co> | ||
* @copyright 2016 Studio Nexus | ||
* @license MIT | ||
* @version Release: 0.2.0 | ||
* @link https://www.studionexus.co/php/damnstupidsimple | ||
* @package StupidlySimple | ||
* @author Fariz Luqman <fariz[email protected]> | ||
* @copyright 2017 Fariz Luqman | ||
* @license MIT | ||
* @since 0.3.3 | ||
* @link https://stupidlysimple.github.io/ | ||
*/ | ||
namespace Core; | ||
|
||
|
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,8 +1,8 @@ | ||
<?php | ||
/** | ||
* Damn Stupid Simple - A PHP Framework For Lazy Developers | ||
* StupidlySimple Framework - A PHP Framework For Lazy Developers | ||
* | ||
* Copyright (c) 2016 Studio Nexus | ||
* Copyright (c) 2017 Fariz Luqman | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a | ||
* copy of this software and associated documentation files (the "Software"), | ||
|
@@ -22,12 +22,12 @@ | |
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
* | ||
* @package Damn Stupid Simple | ||
* @author Studio Nexus <fariz@studionexus.co> | ||
* @copyright 2016 Studio Nexus | ||
* @license MIT | ||
* @version Release: 0.2.0 | ||
* @link https://www.studionexus.co/php/damnstupidsimple | ||
* @package StupidlySimple | ||
* @author Fariz Luqman <fariz[email protected]> | ||
* @copyright 2017 Fariz Luqman | ||
* @license MIT | ||
* @since 0.3.3 | ||
* @link https://stupidlysimple.github.io/ | ||
*/ | ||
namespace Core; | ||
use phpFastCache\CacheManager as CacheManager; | ||
|
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,8 +1,8 @@ | ||
<?php | ||
/** | ||
* Damn Stupid Simple - A PHP Framework For Lazy Developers | ||
* StupidlySimple Framework - A PHP Framework For Lazy Developers | ||
* | ||
* Copyright (c) 2016 Studio Nexus | ||
* Copyright (c) 2017 Fariz Luqman | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a | ||
* copy of this software and associated documentation files (the "Software"), | ||
|
@@ -22,12 +22,12 @@ | |
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
* | ||
* @package Damn Stupid Simple | ||
* @author Studio Nexus <fariz@studionexus.co> | ||
* @copyright 2016 Studio Nexus | ||
* @license MIT | ||
* @version Release: 0.2.0 | ||
* @link https://www.studionexus.co/php/damnstupidsimple | ||
* @package StupidlySimple | ||
* @author Fariz Luqman <fariz[email protected]> | ||
* @copyright 2017 Fariz Luqman | ||
* @license MIT | ||
* @since 0.3.3 | ||
* @link https://stupidlysimple.github.io/ | ||
*/ | ||
namespace Core; | ||
|
||
|
@@ -78,7 +78,7 @@ class Config { | |
*/ | ||
public static function get($file, $key = null){ | ||
if(isset(self::$hive[$file]) === false){ | ||
self::$hive[$file] = include_once(DSS_PATH.'config/'.$file.'.php'); | ||
self::$hive[$file] = include_once(SS_PATH.'config/'.$file.'.php'); | ||
} | ||
|
||
if($key === null){ | ||
|
@@ -99,7 +99,7 @@ public static function get($file, $key = null){ | |
*/ | ||
public static function setEnv(){ | ||
if(self::$env === null){ | ||
self::$env = require_once(DSS_PATH.'config/env.php'); | ||
self::$env = require_once(SS_PATH.'config/env.php'); | ||
} | ||
|
||
foreach(self::$env as $v => $a){ | ||
|
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,8 +1,8 @@ | ||
<?php | ||
/** | ||
* Damn Stupid Simple - A PHP Framework For Lazy Developers | ||
* StupidlySimple Framework - A PHP Framework For Lazy Developers | ||
* | ||
* Copyright (c) 2016 Studio Nexus | ||
* Copyright (c) 2017 Fariz Luqman | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a | ||
* copy of this software and associated documentation files (the "Software"), | ||
|
@@ -22,12 +22,12 @@ | |
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
* | ||
* @package Damn Stupid Simple | ||
* @author Studio Nexus <fariz@studionexus.co> | ||
* @copyright 2016 Studio Nexus | ||
* @license MIT | ||
* @version Release: 0.2.0 | ||
* @link https://www.studionexus.co/php/damnstupidsimple | ||
* @package StupidlySimple | ||
* @author Fariz Luqman <fariz[email protected]> | ||
* @copyright 2017 Fariz Luqman | ||
* @license MIT | ||
* @since 0.3.3 | ||
* @link https://stupidlysimple.github.io/ | ||
*/ | ||
namespace Core; | ||
use Illuminate\Database\Capsule\Manager as Capsule; | ||
|
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,8 +1,8 @@ | ||
<?php | ||
/** | ||
* Damn Stupid Simple - A PHP Framework For Lazy Developers | ||
* StupidlySimple Framework - A PHP Framework For Lazy Developers | ||
* | ||
* Copyright (c) 2016 Studio Nexus | ||
* Copyright (c) 2017 Fariz Luqman | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a | ||
* copy of this software and associated documentation files (the "Software"), | ||
|
@@ -22,12 +22,12 @@ | |
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
* | ||
* @package Damn Stupid Simple | ||
* @author Studio Nexus <fariz@studionexus.co> | ||
* @copyright 2016 Studio Nexus | ||
* @license MIT | ||
* @version Release: 0.2.0 | ||
* @link https://www.studionexus.co/php/damnstupidsimple | ||
* @package StupidlySimple | ||
* @author Fariz Luqman <fariz[email protected]> | ||
* @copyright 2017 Fariz Luqman | ||
* @license MIT | ||
* @since 0.3.3 | ||
* @link https://stupidlysimple.github.io/ | ||
*/ | ||
namespace Core; | ||
|
||
|
@@ -187,7 +187,7 @@ static private function microtime_diff($start) | |
* @since Method available since Release 0.1.0 | ||
*/ | ||
static function exec_time(){ | ||
echo ('<span style="display: table; margin: 0 auto;">Request takes '.(self::microtime_diff(DSS_START) * 1000 ) . ' milliseconds</span>'); | ||
echo ('<span style="display: table; margin: 0 auto;">Request takes '.(self::microtime_diff(SS_START) * 1000 ) . ' milliseconds</span>'); | ||
} | ||
|
||
static function startProfiling(){ | ||
|
@@ -215,7 +215,7 @@ static function addProfilingData($point_name = '', $point_type = 'others'){ | |
} | ||
|
||
static function endProfiling(){ | ||
$timeIncludingAutoloader = self::microtime_diff(DSS_START) * 1000; | ||
$timeIncludingAutoloader = self::microtime_diff(SS_START) * 1000; | ||
$timeProfiled = self::microtime_diff(self::$profilerStartTime) * 1000; | ||
$timeMinusAutoloader = $timeIncludingAutoloader - $timeProfiled; | ||
|
||
|
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,72 @@ | ||
<?php | ||
/** | ||
* StupidlySimple Framework - A PHP Framework For Lazy Developers | ||
* | ||
* Copyright (c) 2017 Fariz Luqman | ||
* | ||
* 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. | ||
* | ||
* @package StupidlySimple | ||
* @author Fariz Luqman <[email protected]> | ||
* @copyright 2017 Fariz Luqman | ||
* @license MIT | ||
* @since 0.3.3 | ||
* @link https://stupidlysimple.github.io/ | ||
*/ | ||
namespace Core; | ||
|
||
class Request { | ||
|
||
private static $_instance = null; | ||
private $data = []; | ||
|
||
private function __construct(){ | ||
// merge data with get, post and files | ||
$this->data = array_merge($_GET, $_POST, $_FILES); | ||
|
||
// start session to get flash variables | ||
if(!isset($_SESSION)){ | ||
session_start(); | ||
} | ||
// merge data with flash variables | ||
if(isset($_SESSION['ss_flash_variables'])){ | ||
$this->data = array_merge($_SESSION['ss_flash_variables']); | ||
unset($_SESSION['ss_flash_variables']); | ||
} | ||
} | ||
|
||
static function get($key = null){ | ||
if (self::$_instance === null) { | ||
self::$_instance = new self; | ||
} | ||
|
||
return self::$_instance->returnRequest($key); | ||
} | ||
|
||
function returnRequest($key = null){ | ||
if($key !== null){ | ||
if(!isset($this->data[$key])){ | ||
return null; | ||
} | ||
return $this->data[$key]; | ||
}else{ | ||
return $this->data; | ||
} | ||
} | ||
} |
Oops, something went wrong.