-
Notifications
You must be signed in to change notification settings - Fork 902
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 a001b32
Showing
390 changed files
with
15,604 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,3 @@ | ||
{ | ||
"directory" : "vendor/bower" | ||
} |
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,33 @@ | ||
# yii console command | ||
/yii | ||
|
||
# phpstorm project files | ||
.idea | ||
|
||
# netbeans project files | ||
nbproject | ||
|
||
# zend studio for eclipse project files | ||
.buildpath | ||
.project | ||
.settings | ||
|
||
# windows thumbnail cache | ||
Thumbs.db | ||
|
||
# composer vendor dir | ||
/vendor | ||
|
||
# composer itself is not needed | ||
composer.phar | ||
composer.lock | ||
|
||
# Mac DS_Store Files | ||
.DS_Store | ||
|
||
# phpunit itself is not needed | ||
phpunit.phar | ||
# local phpunit config | ||
/phpunit.xml | ||
|
||
/conf/* |
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,32 @@ | ||
The Yii framework is free software. It is released under the terms of | ||
the following BSD License. | ||
|
||
Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com) | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions | ||
are met: | ||
|
||
* Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
* Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in | ||
the documentation and/or other materials provided with the | ||
distribution. | ||
* Neither the name of Yii Software LLC nor the names of its | ||
contributors may be used to endorse or promote products derived | ||
from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
POSSIBILITY OF SUCH DAMAGE. |
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,97 @@ | ||
Yii 2 Advanced Application Template | ||
=================================== | ||
|
||
Yii 2 Advanced Application Template is a skeleton Yii 2 application best for | ||
developing complex Web applications with multiple tiers. | ||
|
||
The template includes three tiers: front end, back end, and console, each of which | ||
is a separate Yii application. | ||
|
||
The template is designed to work in a team development environment. It supports | ||
deploying the application in different environments. | ||
|
||
|
||
DIRECTORY STRUCTURE | ||
------------------- | ||
|
||
``` | ||
common | ||
config/ contains shared configurations | ||
mail/ contains view files for e-mails | ||
models/ contains model classes used in both backend and frontend | ||
console | ||
config/ contains console configurations | ||
controllers/ contains console controllers (commands) | ||
migrations/ contains database migrations | ||
models/ contains console-specific model classes | ||
runtime/ contains files generated during runtime | ||
backend | ||
assets/ contains application assets such as JavaScript and CSS | ||
config/ contains backend configurations | ||
controllers/ contains Web controller classes | ||
models/ contains backend-specific model classes | ||
runtime/ contains files generated during runtime | ||
views/ contains view files for the Web application | ||
web/ contains the entry script and Web resources | ||
frontend | ||
assets/ contains application assets such as JavaScript and CSS | ||
config/ contains frontend configurations | ||
controllers/ contains Web controller classes | ||
models/ contains frontend-specific model classes | ||
runtime/ contains files generated during runtime | ||
views/ contains view files for the Web application | ||
web/ contains the entry script and Web resources | ||
widgets/ contains frontend widgets | ||
vendor/ contains dependent 3rd-party packages | ||
environments/ contains environment-based overrides | ||
tests contains various tests for the advanced application | ||
codeception/ contains tests developed with Codeception PHP Testing Framework | ||
``` | ||
|
||
|
||
REQUIREMENTS | ||
------------ | ||
|
||
The minimum requirement by this application template that your Web server supports PHP 5.4.0. | ||
|
||
|
||
INSTALLATION | ||
------------ | ||
|
||
### Install from an Archive File | ||
|
||
Extract the archive file downloaded from [yiiframework.com](http://www.yiiframework.com/download/) to | ||
a directory named `advanced` that is directly under the Web root. | ||
|
||
Then follow the instructions given in "GETTING STARTED". | ||
|
||
|
||
### Install via Composer | ||
|
||
If you do not have [Composer](http://getcomposer.org/), you may install it by following the instructions | ||
at [getcomposer.org](http://getcomposer.org/doc/00-intro.md#installation-nix). | ||
|
||
You can then install the application using the following command: | ||
|
||
~~~ | ||
php composer.phar global require "fxp/composer-asset-plugin:1.0.0-beta4" | ||
php composer.phar create-project --prefer-dist --stability=dev yiisoft/yii2-app-advanced advanced | ||
~~~ | ||
|
||
|
||
GETTING STARTED | ||
--------------- | ||
|
||
After you install the application, you have to conduct the following steps to initialize | ||
the installed application. You only need to do these once for all. | ||
|
||
1. Run command `init` to initialize the application with a specific environment. | ||
2. Create a new database and adjust the `components['db']` configuration in `common/config/main-local.php` accordingly. | ||
3. Apply migrations with console command `yii migrate`. This will create tables needed for the application to work. | ||
4. Set document roots of your Web server: | ||
|
||
- for frontend `/path/to/yii-application/frontend/web/` and using the URL `http://frontend/` | ||
- for backend `/path/to/yii-application/backend/web/` and using the URL `http://backend/` | ||
|
||
To login into the application, you need to first sign up, with any of your email address, username and password. | ||
Then, you can login into the application with same email address and password at any time. |
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,29 @@ | ||
<?php | ||
/** | ||
* @link http://www.yiiframework.com/ | ||
* @copyright Copyright (c) 2008 Yii Software LLC | ||
* @license http://www.yiiframework.com/license/ | ||
*/ | ||
|
||
namespace backend\assets; | ||
|
||
use yii\web\AssetBundle; | ||
|
||
/** | ||
* @author Qiang Xue <[email protected]> | ||
* @since 2.0 | ||
*/ | ||
class AppAsset extends AssetBundle | ||
{ | ||
public $basePath = '@webroot'; | ||
public $baseUrl = '@web'; | ||
public $css = [ | ||
'css/site.css', | ||
]; | ||
public $js = [ | ||
]; | ||
public $depends = [ | ||
'yii\web\YiiAsset', | ||
'yii\bootstrap\BootstrapAsset', | ||
]; | ||
} |
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 @@ | ||
main-local.php | ||
params-local.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 @@ | ||
<?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,34 @@ | ||
<?php | ||
$params = array_merge( | ||
require(__DIR__ . '/../../common/config/params.php'), | ||
require(__DIR__ . '/../../common/config/params-local.php'), | ||
require(__DIR__ . '/params.php'), | ||
require(__DIR__ . '/params-local.php') | ||
); | ||
|
||
return [ | ||
'id' => 'app-backend', | ||
'basePath' => dirname(__DIR__), | ||
'controllerNamespace' => 'backend\controllers', | ||
'bootstrap' => ['log'], | ||
'modules' => [], | ||
'components' => [ | ||
'user' => [ | ||
'identityClass' => 'common\models\User', | ||
'enableAutoLogin' => true, | ||
], | ||
'log' => [ | ||
'traceLevel' => YII_DEBUG ? 3 : 0, | ||
'targets' => [ | ||
[ | ||
'class' => 'yii\log\FileTarget', | ||
'levels' => ['error', 'warning'], | ||
], | ||
], | ||
], | ||
'errorHandler' => [ | ||
'errorAction' => 'site/error', | ||
], | ||
], | ||
'params' => $params, | ||
]; |
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 @@ | ||
<?php | ||
return [ | ||
'adminEmail' => '[email protected]', | ||
]; |
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,83 @@ | ||
<?php | ||
namespace backend\controllers; | ||
|
||
use Yii; | ||
use yii\filters\AccessControl; | ||
use yii\web\Controller; | ||
use common\models\LoginForm; | ||
use yii\filters\VerbFilter; | ||
|
||
/** | ||
* Site controller | ||
*/ | ||
class SiteController extends Controller | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public function behaviors() | ||
{ | ||
return [ | ||
'access' => [ | ||
'class' => AccessControl::className(), | ||
'rules' => [ | ||
[ | ||
'actions' => ['login', 'error'], | ||
'allow' => true, | ||
], | ||
[ | ||
'actions' => ['logout', 'index'], | ||
'allow' => true, | ||
'roles' => ['@'], | ||
], | ||
], | ||
], | ||
'verbs' => [ | ||
'class' => VerbFilter::className(), | ||
'actions' => [ | ||
'logout' => ['post'], | ||
], | ||
], | ||
]; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function actions() | ||
{ | ||
return [ | ||
'error' => [ | ||
'class' => 'yii\web\ErrorAction', | ||
], | ||
]; | ||
} | ||
|
||
public function actionIndex() | ||
{ | ||
return $this->render('index'); | ||
} | ||
|
||
public function actionLogin() | ||
{ | ||
if (!\Yii::$app->user->isGuest) { | ||
return $this->goHome(); | ||
} | ||
|
||
$model = new LoginForm(); | ||
if ($model->load(Yii::$app->request->post()) && $model->login()) { | ||
return $this->goBack(); | ||
} else { | ||
return $this->render('login', [ | ||
'model' => $model, | ||
]); | ||
} | ||
} | ||
|
||
public function actionLogout() | ||
{ | ||
Yii::$app->user->logout(); | ||
|
||
return $this->goHome(); | ||
} | ||
} |
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 @@ | ||
* |
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 @@ | ||
* | ||
!.gitignore |
Oops, something went wrong.