Skip to content

Commit 74b6d0e

Browse files
committed
update to #9b2a01f yii2
1 parent 0d13373 commit 74b6d0e

File tree

164 files changed

+3057
-2693
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+3057
-2693
lines changed

.gitignore

+30-30
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
# yii console command
2-
/yii
3-
4-
# phpstorm project files
5-
.idea
6-
7-
# netbeans project files
8-
nbproject
9-
10-
# zend studio for eclipse project files
11-
.buildpath
12-
.project
13-
.settings
14-
15-
# windows thumbnail cache
16-
Thumbs.db
17-
18-
# composer vendor dir
19-
/vendor
20-
21-
# composer itself is not needed
22-
composer.phar
23-
24-
# Mac DS_Store Files
25-
.DS_Store
26-
27-
# phpunit itself is not needed
28-
phpunit.phar
29-
# local phpunit config
30-
/phpunit.xml
1+
# yii console command
2+
/yii
3+
4+
# phpstorm project files
5+
.idea
6+
7+
# netbeans project files
8+
nbproject
9+
10+
# zend studio for eclipse project files
11+
.buildpath
12+
.project
13+
.settings
14+
15+
# windows thumbnail cache
16+
Thumbs.db
17+
18+
# composer vendor dir
19+
/vendor
20+
21+
# composer itself is not needed
22+
composer.phar
23+
24+
# Mac DS_Store Files
25+
.DS_Store
26+
27+
# phpunit itself is not needed
28+
phpunit.phar
29+
# local phpunit config
30+
/phpunit.xml

LICENSE.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
The Yii framework is free software. It is released under the terms of
2+
the following BSD License.
3+
4+
Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com)
5+
All rights reserved.
6+
7+
Redistribution and use in source and binary forms, with or without
8+
modification, are permitted provided that the following conditions
9+
are met:
10+
11+
* Redistributions of source code must retain the above copyright
12+
notice, this list of conditions and the following disclaimer.
13+
* Redistributions in binary form must reproduce the above copyright
14+
notice, this list of conditions and the following disclaimer in
15+
the documentation and/or other materials provided with the
16+
distribution.
17+
* Neither the name of Yii Software LLC nor the names of its
18+
contributors may be used to endorse or promote products derived
19+
from this software without specific prior written permission.
20+
21+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24+
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25+
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31+
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32+
POSSIBILITY OF SUCH DAMAGE.

README.md

+79-30
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,79 @@
1-
## Test REST API application on [Yii2](https://github.com/yiisoft/yii2)
2-
3-
###INSTALLATION###
4-
5-
**Install via Composer**
6-
7-
If you do not have [Composer](http://getcomposer.org/), you may install it by following the
8-
[instructions at getcomposer.org](https://getcomposer.org/doc/00-intro.md).
9-
10-
You can then install the application using the following command:
11-
`composer create-project --prefer-dist -s dev "githubjeka/rest-yii2" .`
12-
13-
###GETTING STARTED###
14-
15-
After you install the application, you have to conduct the following steps to initialize the installed application.
16-
You only need to do these once for all.
17-
18-
- Create a new database and adjust the components['db'] configuration in `environments/dev/common/config/main-local.php` accordingly.
19-
- Run command `php init` to initialize the application with a specific environment. Choose **dev**.
20-
- Apply migrations with console command ``php yii migrate``. This will create tables needed for the application to work.
21-
- Set document roots of your Web server:
22-
23-
for frontend /path/to/yii-application/rest/web/ and using the URL http://rest-localhost/
24-
for backend /path/to/yii-application/backend/web/ and using the URL http://backend-localhost/
25-
26-
To login into the application is `demo/demo`.
27-
28-
[More information ... ](https://github.com/githubjeka/angular-yii2)
29-
30-
**TBD..**
1+
## Test REST API application on [Yii2](https://github.com/yiisoft/yii2)
2+
3+
###INSTALLATION###
4+
5+
**Install via Composer**
6+
7+
If you do not have [Composer](http://getcomposer.org/), you may install it by following the
8+
[instructions at getcomposer.org](https://getcomposer.org/doc/00-intro.md).
9+
10+
You can then install the application using the following command:
11+
`composer create-project --prefer-dist -s dev "githubjeka/rest-yii2" .`
12+
13+
###GETTING STARTED###
14+
15+
After you install the application, you have to conduct the following steps to initialize the installed application.
16+
You only need to do these once for all.
17+
18+
- Create a new database and adjust the components['db'] configuration in `environments/dev/common/config/main-local.php` accordingly.
19+
- Run command `php init` to initialize the application with a specific environment. Choose **dev**.
20+
- Apply migrations with console command ``php yii migrate``. This will create tables needed for the application to work.
21+
- Set document roots of your Web server:
22+
23+
for rest /path/to/yii-application/rest/web/ and using the URL http://localhost/
24+
for backend /path/to/yii-application/backend/web/ and using the URL http://backend-localhost/
25+
26+
Use `demo/demo` to login into the application on http://localhost/v1/user/login. See /rest/config/main.php for more info by URL
27+
28+
###Configuration for Apache###
29+
Add `.htaccess` to `\rest\web`
30+
```
31+
RewriteEngine on
32+
33+
RewriteCond %{REQUEST_FILENAME} !-f
34+
RewriteCond %{REQUEST_FILENAME} !-d
35+
RewriteRule (.*) index.php [L]
36+
```
37+
38+
###Configuration for Nginx###
39+
```
40+
include common/upstream;
41+
42+
server {
43+
charset utf-8;
44+
client_max_body_size 128M;
45+
46+
listen 80; ## listen for ipv4
47+
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6
48+
49+
server_name localhost;
50+
root /var/www/rest/rest/web;
51+
index index.php;
52+
53+
#access_log /var/www/log/rest-access.log main;
54+
#error_log /var/www/log/rest-error.log;
55+
56+
location / {
57+
# Redirect everything that isn't a real file to index.php
58+
try_files $uri $uri/ /index.php?$args;
59+
}
60+
61+
# uncomment to avoid processing of calls to non-existing static files by Yii
62+
location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
63+
try_files $uri =404;
64+
}
65+
#error_page 404 /404.html;
66+
67+
location ~ \.php$ {
68+
include common/php-fpm;
69+
try_files $uri =404;
70+
}
71+
72+
location ~ /\.(ht|svn|git) {
73+
deny all;
74+
}
75+
}
76+
```
77+
[More information ... ](https://github.com/githubjeka/angular-yii2)
78+
79+
**TBD..**

backend/assets/AppAsset.php

+26-26
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
<?php
2-
/**
3-
* @link http://www.yiiframework.com/
4-
* @copyright Copyright (c) 2008 Yii Software LLC
5-
* @license http://www.yiiframework.com/license/
6-
*/
7-
8-
namespace backend\assets;
9-
10-
use yii\web\AssetBundle;
11-
12-
/**
13-
* @author Qiang Xue <[email protected]>
14-
* @since 2.0
15-
*/
16-
class AppAsset extends AssetBundle
17-
{
18-
public $basePath = '@webroot';
19-
public $baseUrl = '@web';
20-
public $css = ['css/site.css'];
21-
public $js = [];
22-
public $depends = [
23-
'yii\web\YiiAsset',
24-
'yii\bootstrap\BootstrapAsset',
25-
];
26-
}
1+
<?php
2+
/**
3+
* @link http://www.yiiframework.com/
4+
* @copyright Copyright (c) 2008 Yii Software LLC
5+
* @license http://www.yiiframework.com/license/
6+
*/
7+
8+
namespace backend\assets;
9+
10+
use yii\web\AssetBundle;
11+
12+
/**
13+
* @author Qiang Xue <[email protected]>
14+
* @since 2.0
15+
*/
16+
class AppAsset extends AssetBundle
17+
{
18+
public $basePath = '@webroot';
19+
public $baseUrl = '@web';
20+
public $css = ['css/site.css'];
21+
public $js = [];
22+
public $depends = [
23+
'yii\web\YiiAsset',
24+
'yii\bootstrap\BootstrapAsset',
25+
];
26+
}

backend/codeception.yml

-18
This file was deleted.

backend/config/.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
main-local.php
1+
main-local.php
22
params-local.php

backend/config/bootstrap.php

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?php

backend/config/main.php

+34-34
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
<?php
2-
$params = array_merge(
3-
require(__DIR__ . '/../../common/config/params.php'),
4-
require(__DIR__ . '/../../common/config/params-local.php'),
5-
require(__DIR__ . '/params.php'),
6-
require(__DIR__ . '/params-local.php')
7-
);
8-
9-
return [
10-
'id' => 'app-backend',
11-
'basePath' => dirname(__DIR__),
12-
'controllerNamespace' => 'backend\controllers',
13-
'bootstrap' => ['log'],
14-
'modules' => [],
15-
'components' => [
16-
'user' => [
17-
'identityClass' => 'common\models\User',
18-
'enableAutoLogin' => true,
19-
],
20-
'log' => [
21-
'traceLevel' => YII_DEBUG ? 3 : 0,
22-
'targets' => [
23-
[
24-
'class' => 'yii\log\FileTarget',
25-
'levels' => ['error', 'warning'],
26-
],
27-
],
28-
],
29-
'errorHandler' => [
30-
'errorAction' => 'site/error',
31-
],
32-
],
33-
'params' => $params,
34-
];
1+
<?php
2+
$params = array_merge(
3+
require(__DIR__ . '/../../common/config/params.php'),
4+
require(__DIR__ . '/../../common/config/params-local.php'),
5+
require(__DIR__ . '/params.php'),
6+
require(__DIR__ . '/params-local.php')
7+
);
8+
9+
return [
10+
'id' => 'app-backend',
11+
'basePath' => dirname(__DIR__),
12+
'controllerNamespace' => 'backend\controllers',
13+
'bootstrap' => ['log'],
14+
'modules' => [],
15+
'components' => [
16+
'user' => [
17+
'identityClass' => 'common\models\User',
18+
'enableAutoLogin' => true,
19+
],
20+
'log' => [
21+
'traceLevel' => YII_DEBUG ? 3 : 0,
22+
'targets' => [
23+
[
24+
'class' => 'yii\log\FileTarget',
25+
'levels' => ['error', 'warning'],
26+
],
27+
],
28+
],
29+
'errorHandler' => [
30+
'errorAction' => 'site/error',
31+
],
32+
],
33+
'params' => $params,
34+
];

backend/config/params.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
2-
return [
3-
'adminEmail' => '[email protected]',
4-
];
1+
<?php
2+
return [
3+
'adminEmail' => '[email protected]',
4+
];

0 commit comments

Comments
 (0)