-
Notifications
You must be signed in to change notification settings - Fork 5
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
0 parents
commit b5087dc
Showing
12 changed files
with
234 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/vendor | ||
composer.phar | ||
composer.lock | ||
.php_cs.cache |
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,22 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015 OzCat | ||
|
||
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. | ||
|
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,2 @@ | ||
# framework | ||
OzCat framework |
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,39 @@ | ||
{ | ||
"name": "pongtan/framework", | ||
"description": "The Pongtan Framework.", | ||
"authors": [ | ||
{ | ||
"name": "Xiaobin", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"slim/slim": "^3.0", | ||
"illuminate/database": "*", | ||
"slim/twig-view": "~2.0", | ||
"slim/csrf": "0.5.*", | ||
"monolog/monolog": "^1.18", | ||
"smarty/smarty": "~3.1", | ||
"mailgun/mailgun-php": "~1.7.2", | ||
"predis/predis": "~1.0", | ||
"phpmailer/phpmailer": "~5.2", | ||
"illuminate/pagination": "~5.1", | ||
"vlucas/phpdotenv": "~2.1", | ||
"zeuxisoo/slim-whoops": "0.4.*", | ||
"firebase/php-jwt": "~3.0", | ||
"aws/aws-sdk-php": "3.*", | ||
"gregwar/captcha": "1.*", | ||
"desarrolla2/cache": "~2.0" | ||
}, | ||
"autoload": { | ||
"classmap": [ | ||
|
||
], | ||
"files": [ | ||
"src/Pongtan/Support/helpers.php" | ||
], | ||
"psr-4": { | ||
"Pongtan\\": "src/Pongtan" | ||
} | ||
} | ||
} |
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,57 @@ | ||
<?php | ||
|
||
namespace Pongtan; | ||
|
||
use Pongtan\Services\Config; | ||
use Dotenv\Dotenv; | ||
use Illuminate\Database\Capsule\Manager as Capsule; | ||
|
||
class App | ||
{ | ||
protected $basePath; | ||
|
||
public function __construct() | ||
{ | ||
} | ||
|
||
/** | ||
* @param $path | ||
*/ | ||
public function setBasePath($path) | ||
{ | ||
$this->basePath = $path; | ||
} | ||
|
||
public function loadEnv() | ||
{ | ||
$env = new Dotenv($this->basePath); | ||
$env->load(); | ||
} | ||
|
||
public function setDebug() | ||
{ | ||
// debug | ||
if (Config::get('debug') == "true") { | ||
define("DEBUG", true); | ||
} | ||
} | ||
|
||
public function setVersion($version) | ||
{ | ||
$_ENV['version'] = $version; | ||
} | ||
|
||
public function setTimezone() | ||
{ | ||
// config time zone | ||
date_default_timezone_set(Config::get('timeZone')); | ||
} | ||
|
||
public function bootDb() | ||
{ | ||
// Init Eloquent ORM Connection | ||
$capsule = new Capsule; | ||
$capsule->addConnection(Config::getDbConfig()); | ||
$capsule->bootEloquent(); | ||
} | ||
} |
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,10 @@ | ||
<?php | ||
|
||
|
||
namespace Pongtan\Cache; | ||
|
||
|
||
class Factory | ||
{ | ||
|
||
} |
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,10 @@ | ||
<?php | ||
|
||
|
||
namespace Pongtan\Cache; | ||
|
||
|
||
class 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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace Pongtan\Database; | ||
|
||
|
||
use Illuminate\Database\Eloquent\Model as EloquentModel; | ||
|
||
class Model extends EloquentModel | ||
{ | ||
|
||
} |
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,38 @@ | ||
<?php | ||
|
||
namespace Pongtan\Http; | ||
|
||
use Pongtan\View\Factory; | ||
|
||
class Controller | ||
{ | ||
public $view; | ||
|
||
public $smarty; | ||
|
||
public function construct__() | ||
{ | ||
|
||
} | ||
|
||
public function smarty() | ||
{ | ||
$this->smarty = Factory::newSmarty(); | ||
return $this->smarty; | ||
} | ||
|
||
public function view() | ||
{ | ||
return $this->smarty(); | ||
} | ||
|
||
/** | ||
* @param $response | ||
* @param $res | ||
* @return mixed | ||
*/ | ||
public function echoJson($response, $res) | ||
{ | ||
return $response->getBody()->write(json_encode($res)); | ||
} | ||
} |
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,19 @@ | ||
<?php | ||
|
||
namespace Pongtan\Services; | ||
|
||
|
||
class Config | ||
{ | ||
public static function get($key) | ||
{ | ||
$key = getenv($key); | ||
if ($key == 'true') { | ||
return true; | ||
} | ||
if ($key == 'false') { | ||
return false; | ||
} | ||
return $key; | ||
} | ||
} |
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 @@ | ||
<?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,21 @@ | ||
<?php | ||
|
||
namespace OzCat\View; | ||
|
||
use Smarty; | ||
|
||
class Factory | ||
{ | ||
public static function newSmarty() | ||
{ | ||
$smarty = new smarty(); //实例化smarty | ||
$smarty->settemplatedir(BASE_PATH . '/resources/views/' . Config::get('theme') . '/'); //设置模板文件存放目录 | ||
$smarty->setcompiledir(BASE_PATH . '/storage/framework/smarty/compile/'); //设置生成文件存放目录 | ||
$smarty->setcachedir(BASE_PATH . '/storage/framework/smarty/cache/'); //设置缓存文件存放目录 | ||
// add config | ||
$smarty->assign('config', Config::getPublicConfig()); | ||
$smarty->assign('user', Auth::getUser()); | ||
return $smarty; | ||
} | ||
|
||
} |