Browse Source

Merge branch 'master' of github.com:yiisoft/yii2 into sphinx

tags/2.0.0-beta
Paul Klimov 11 years ago
parent
commit
afcdcb9a72
  1. 4
      LICENSE.md
  2. 4
      apps/advanced/LICENSE.md
  3. 2
      apps/advanced/backend/config/main.php
  4. 7
      apps/advanced/backend/controllers/SiteController.php
  5. 2
      apps/advanced/backend/views/layouts/main.php
  6. 2
      apps/advanced/backend/views/site/error.php
  7. 2
      apps/advanced/backend/views/site/index.php
  8. 2
      apps/advanced/backend/views/site/login.php
  9. 4
      apps/advanced/composer.json
  10. 2
      apps/advanced/console/config/main.php
  11. 2
      apps/advanced/frontend/config/main.php
  12. 8
      apps/advanced/frontend/controllers/SiteController.php
  13. 2
      apps/advanced/frontend/views/emails/passwordResetToken.php
  14. 2
      apps/advanced/frontend/views/layouts/main.php
  15. 2
      apps/advanced/frontend/views/site/about.php
  16. 2
      apps/advanced/frontend/views/site/contact.php
  17. 2
      apps/advanced/frontend/views/site/error.php
  18. 2
      apps/advanced/frontend/views/site/index.php
  19. 2
      apps/advanced/frontend/views/site/login.php
  20. 2
      apps/advanced/frontend/views/site/requestPasswordResetToken.php
  21. 2
      apps/advanced/frontend/views/site/resetPassword.php
  22. 2
      apps/advanced/frontend/views/site/signup.php
  23. 4
      apps/advanced/init
  24. 4
      apps/basic/LICENSE.md
  25. 4
      apps/basic/composer.json
  26. 2
      apps/basic/config/console.php
  27. 2
      apps/basic/config/web.php
  28. 11
      apps/basic/controllers/SiteController.php
  29. 2
      apps/basic/views/layouts/main.php
  30. 2
      apps/basic/views/site/about.php
  31. 2
      apps/basic/views/site/contact.php
  32. 2
      apps/basic/views/site/error.php
  33. 2
      apps/basic/views/site/index.php
  34. 2
      apps/basic/views/site/login.php
  35. 4
      apps/benchmark/LICENSE.md
  36. 2
      docs/api/db/ActiveRecord.md
  37. 16
      docs/guide/authentication.md
  38. 2
      docs/guide/authorization.md
  39. 50
      docs/guide/composer.md
  40. 2
      docs/guide/configuration.md
  41. 11
      docs/guide/debugger.md
  42. 20
      docs/guide/form.md
  43. 2
      docs/guide/i18n.md
  44. 78
      docs/guide/installation.md
  45. 61
      docs/guide/mvc.md
  46. 2
      docs/guide/query-builder.md
  47. 8
      docs/guide/security.md
  48. 2
      docs/guide/template.md
  49. 48
      docs/guide/url.md
  50. 2
      docs/guide/validation.md
  51. 6
      docs/guide/view.md
  52. 0
      extensions/bootstrap/Alert.php
  53. 2
      extensions/bootstrap/BootstrapAsset.php
  54. 2
      extensions/bootstrap/BootstrapPluginAsset.php
  55. 2
      extensions/bootstrap/BootstrapThemeAsset.php
  56. 0
      extensions/bootstrap/Button.php
  57. 0
      extensions/bootstrap/ButtonDropdown.php
  58. 0
      extensions/bootstrap/ButtonGroup.php
  59. 0
      extensions/bootstrap/Carousel.php
  60. 0
      extensions/bootstrap/Collapse.php
  61. 0
      extensions/bootstrap/Dropdown.php
  62. 0
      extensions/bootstrap/Modal.php
  63. 0
      extensions/bootstrap/Nav.php
  64. 0
      extensions/bootstrap/NavBar.php
  65. 0
      extensions/bootstrap/Progress.php
  66. 32
      extensions/bootstrap/README.md
  67. 0
      extensions/bootstrap/Tabs.php
  68. 0
      extensions/bootstrap/Widget.php
  69. 20
      extensions/bootstrap/composer.json
  70. 60
      extensions/composer/Installer.php
  71. 2
      extensions/composer/LICENSE.md
  72. 5
      extensions/composer/Plugin.php
  73. 91
      extensions/composer/README.md
  74. 1
      extensions/composer/composer.json
  75. 0
      extensions/debug/DebugAsset.php
  76. 0
      extensions/debug/LogTarget.php
  77. 2
      extensions/debug/Module.php
  78. 0
      extensions/debug/Panel.php
  79. 46
      extensions/debug/README.md
  80. 0
      extensions/debug/assets/main.css
  81. 23
      extensions/debug/composer.json
  82. 0
      extensions/debug/controllers/DefaultController.php
  83. 0
      extensions/debug/panels/ConfigPanel.php
  84. 0
      extensions/debug/panels/DbPanel.php
  85. 0
      extensions/debug/panels/LogPanel.php
  86. 0
      extensions/debug/panels/ProfilingPanel.php
  87. 0
      extensions/debug/panels/RequestPanel.php
  88. 2
      extensions/debug/views/default/index.php
  89. 0
      extensions/debug/views/default/toolbar.css
  90. 0
      extensions/debug/views/default/toolbar.js
  91. 2
      extensions/debug/views/default/toolbar.php
  92. 2
      extensions/debug/views/default/view.php
  93. 2
      extensions/debug/views/layouts/main.php
  94. 0
      extensions/gii/CodeFile.php
  95. 2
      extensions/gii/Generator.php
  96. 0
      extensions/gii/GiiAsset.php
  97. 0
      extensions/gii/Module.php
  98. 47
      extensions/gii/README.md
  99. 2
      extensions/gii/assets/gii.js
  100. 0
      extensions/gii/assets/logo.png
  101. Some files were not shown because too many files have changed in this diff Show More

4
LICENSE.md

@ -1,7 +1,7 @@
The Yii framework is free software. It is released under the terms of The Yii framework is free software. It is released under the terms of
the following BSD License. the following BSD License.
Copyright © 2008-2013 by Yii Software LLC (http://www.yiisoft.com) Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com)
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
@ -29,4 +29,4 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.

4
apps/advanced/LICENSE.md

@ -1,7 +1,7 @@
The Yii framework is free software. It is released under the terms of The Yii framework is free software. It is released under the terms of
the following BSD License. the following BSD License.
Copyright © 2008-2013 by Yii Software LLC (http://www.yiisoft.com) Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com)
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
@ -29,4 +29,4 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.

2
apps/advanced/backend/config/main.php

@ -15,7 +15,7 @@ return [
'preload' => ['log'], 'preload' => ['log'],
'controllerNamespace' => 'backend\controllers', 'controllerNamespace' => 'backend\controllers',
'modules' => [], 'modules' => [],
'extensions' => require(__DIR__ . '/../../vendor/yii-extensions.php'), 'extensions' => require(__DIR__ . '/../../vendor/yiisoft/extensions.php'),
'components' => [ 'components' => [
'request' => [ 'request' => [
'enableCsrfValidation' => true, 'enableCsrfValidation' => true,

7
apps/advanced/backend/controllers/SiteController.php

@ -15,9 +15,8 @@ class SiteController extends Controller
'class' => \yii\web\AccessControl::className(), 'class' => \yii\web\AccessControl::className(),
'rules' => [ 'rules' => [
[ [
'actions' => ['login'], 'actions' => ['login', 'error'],
'allow' => true, 'allow' => true,
'roles' => ['?'],
], ],
[ [
'actions' => ['logout', 'index'], 'actions' => ['logout', 'index'],
@ -45,6 +44,10 @@ class SiteController extends Controller
public function actionLogin() public function actionLogin()
{ {
if (!\Yii::$app->user->isGuest) {
$this->goHome();
}
$model = new LoginForm(); $model = new LoginForm();
if ($model->load($_POST) && $model->login()) { if ($model->load($_POST) && $model->login()) {
return $this->goHome(); return $this->goHome();

2
apps/advanced/backend/views/layouts/main.php

@ -6,7 +6,7 @@ use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs; use yii\widgets\Breadcrumbs;
/** /**
* @var $this \yii\base\View * @var $this \yii\web\View
* @var $content string * @var $content string
*/ */
AppAsset::register($this); AppAsset::register($this);

2
apps/advanced/backend/views/site/error.php

@ -3,7 +3,7 @@
use yii\helpers\Html; use yii\helpers\Html;
/** /**
* @var yii\base\View $this * @var yii\web\View $this
* @var string $name * @var string $name
* @var string $message * @var string $message
* @var Exception $exception * @var Exception $exception

2
apps/advanced/backend/views/site/index.php

@ -1,6 +1,6 @@
<?php <?php
/** /**
* @var yii\base\View $this * @var yii\web\View $this
*/ */
$this->title = 'My Yii Application'; $this->title = 'My Yii Application';
?> ?>

2
apps/advanced/backend/views/site/login.php

@ -3,7 +3,7 @@ use yii\helpers\Html;
use yii\widgets\ActiveForm; use yii\widgets\ActiveForm;
/** /**
* @var yii\base\View $this * @var yii\web\View $this
* @var yii\widgets\ActiveForm $form * @var yii\widgets\ActiveForm $form
* @var app\models\LoginForm $model * @var app\models\LoginForm $model
*/ */

4
apps/advanced/composer.json

@ -16,7 +16,9 @@
"require": { "require": {
"php": ">=5.4.0", "php": ">=5.4.0",
"yiisoft/yii2": "dev-master", "yiisoft/yii2": "dev-master",
"yiisoft/yii2-composer": "dev-master" "yiisoft/yii2-bootstrap": "dev-master",
"yiisoft/yii2-debug": "dev-master",
"yiisoft/yii2-gii": "dev-master"
}, },
"scripts": { "scripts": {
"post-create-project-cmd": [ "post-create-project-cmd": [

2
apps/advanced/console/config/main.php

@ -15,7 +15,7 @@ return [
'controllerNamespace' => 'console\controllers', 'controllerNamespace' => 'console\controllers',
'modules' => [ 'modules' => [
], ],
'extensions' => require(__DIR__ . '/../../vendor/yii-extensions.php'), 'extensions' => require(__DIR__ . '/../../vendor/yiisoft/extensions.php'),
'components' => [ 'components' => [
'db' => $params['components.db'], 'db' => $params['components.db'],
'cache' => $params['components.cache'], 'cache' => $params['components.cache'],

2
apps/advanced/frontend/config/main.php

@ -16,7 +16,7 @@ return [
'modules' => [ 'modules' => [
'gii' => 'yii\gii\Module' 'gii' => 'yii\gii\Module'
], ],
'extensions' => require(__DIR__ . '/../../vendor/yii-extensions.php'), 'extensions' => require(__DIR__ . '/../../vendor/yiisoft/extensions.php'),
'components' => [ 'components' => [
'request' => [ 'request' => [
'enableCsrfValidation' => true, 'enableCsrfValidation' => true,

8
apps/advanced/frontend/controllers/SiteController.php

@ -17,10 +17,10 @@ class SiteController extends Controller
return [ return [
'access' => [ 'access' => [
'class' => \yii\web\AccessControl::className(), 'class' => \yii\web\AccessControl::className(),
'only' => ['login', 'logout', 'signup'], 'only' => ['logout', 'signup'],
'rules' => [ 'rules' => [
[ [
'actions' => ['login', 'signup'], 'actions' => ['signup'],
'allow' => true, 'allow' => true,
'roles' => ['?'], 'roles' => ['?'],
], ],
@ -54,6 +54,10 @@ class SiteController extends Controller
public function actionLogin() public function actionLogin()
{ {
if (!\Yii::$app->user->isGuest) {
$this->goHome();
}
$model = new LoginForm(); $model = new LoginForm();
if ($model->load($_POST) && $model->login()) { if ($model->load($_POST) && $model->login()) {
return $this->goHome(); return $this->goHome();

2
apps/advanced/frontend/views/emails/passwordResetToken.php

@ -2,7 +2,7 @@
use yii\helpers\Html; use yii\helpers\Html;
/** /**
* @var yii\base\View $this * @var yii\web\View $this
* @var common\models\User $user; * @var common\models\User $user;
*/ */

2
apps/advanced/frontend/views/layouts/main.php

@ -7,7 +7,7 @@ use yii\widgets\Breadcrumbs;
use frontend\widgets\Alert; use frontend\widgets\Alert;
/** /**
* @var $this \yii\base\View * @var $this \yii\web\View
* @var $content string * @var $content string
*/ */
AppAsset::register($this); AppAsset::register($this);

2
apps/advanced/frontend/views/site/about.php

@ -2,7 +2,7 @@
use yii\helpers\Html; use yii\helpers\Html;
/** /**
* @var yii\base\View $this * @var yii\web\View $this
*/ */
$this->title = 'About'; $this->title = 'About';
$this->params['breadcrumbs'][] = $this->title; $this->params['breadcrumbs'][] = $this->title;

2
apps/advanced/frontend/views/site/contact.php

@ -4,7 +4,7 @@ use yii\widgets\ActiveForm;
use yii\captcha\Captcha; use yii\captcha\Captcha;
/** /**
* @var yii\base\View $this * @var yii\web\View $this
* @var yii\widgets\ActiveForm $form * @var yii\widgets\ActiveForm $form
* @var app\models\ContactForm $model * @var app\models\ContactForm $model
*/ */

2
apps/advanced/frontend/views/site/error.php

@ -3,7 +3,7 @@
use yii\helpers\Html; use yii\helpers\Html;
/** /**
* @var yii\base\View $this * @var yii\web\View $this
* @var string $name * @var string $name
* @var string $message * @var string $message
* @var Exception $exception * @var Exception $exception

2
apps/advanced/frontend/views/site/index.php

@ -1,6 +1,6 @@
<?php <?php
/** /**
* @var yii\base\View $this * @var yii\web\View $this
*/ */
$this->title = 'My Yii Application'; $this->title = 'My Yii Application';
?> ?>

2
apps/advanced/frontend/views/site/login.php

@ -3,7 +3,7 @@ use yii\helpers\Html;
use yii\widgets\ActiveForm; use yii\widgets\ActiveForm;
/** /**
* @var yii\base\View $this * @var yii\web\View $this
* @var yii\widgets\ActiveForm $form * @var yii\widgets\ActiveForm $form
* @var app\models\LoginForm $model * @var app\models\LoginForm $model
*/ */

2
apps/advanced/frontend/views/site/requestPasswordResetToken.php

@ -3,7 +3,7 @@ use yii\helpers\Html;
use yii\widgets\ActiveForm; use yii\widgets\ActiveForm;
/** /**
* @var yii\base\View $this * @var yii\web\View $this
* @var yii\widgets\ActiveForm $form * @var yii\widgets\ActiveForm $form
* @var common\models\User $model * @var common\models\User $model
*/ */

2
apps/advanced/frontend/views/site/resetPassword.php

@ -3,7 +3,7 @@ use yii\helpers\Html;
use yii\widgets\ActiveForm; use yii\widgets\ActiveForm;
/** /**
* @var yii\base\View $this * @var yii\web\View $this
* @var yii\widgets\ActiveForm $form * @var yii\widgets\ActiveForm $form
* @var common\models\User $model * @var common\models\User $model
*/ */

2
apps/advanced/frontend/views/site/signup.php

@ -3,7 +3,7 @@ use yii\helpers\Html;
use yii\widgets\ActiveForm; use yii\widgets\ActiveForm;
/** /**
* @var yii\base\View $this * @var yii\web\View $this
* @var yii\widgets\ActiveForm $form * @var yii\widgets\ActiveForm $form
* @var common\models\User $model * @var common\models\User $model
*/ */

4
apps/advanced/init

@ -18,7 +18,7 @@ if (empty($params['env'])) {
if (!ctype_digit($answer) || !in_array($answer, range(0, count($envs) - 1))) { if (!ctype_digit($answer) || !in_array($answer, range(0, count($envs) - 1))) {
echo "\n Quit initialization.\n"; echo "\n Quit initialization.\n";
exit(1); exit(0);
} }
if (isset($envNames[$answer])) { if (isset($envNames[$answer])) {
@ -42,7 +42,7 @@ if (empty($params['env'])) {
$answer = trim(fgets(STDIN)); $answer = trim(fgets(STDIN));
if (strncasecmp($answer, 'y', 1)) { if (strncasecmp($answer, 'y', 1)) {
echo "\n Quit initialization.\n"; echo "\n Quit initialization.\n";
exit(1); exit(0);
} }
} }

4
apps/basic/LICENSE.md

@ -1,7 +1,7 @@
The Yii framework is free software. It is released under the terms of The Yii framework is free software. It is released under the terms of
the following BSD License. the following BSD License.
Copyright © 2008-2013 by Yii Software LLC (http://www.yiisoft.com) Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com)
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
@ -29,4 +29,4 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.

4
apps/basic/composer.json

@ -16,7 +16,9 @@
"require": { "require": {
"php": ">=5.4.0", "php": ">=5.4.0",
"yiisoft/yii2": "dev-master", "yiisoft/yii2": "dev-master",
"yiisoft/yii2-composer": "dev-master" "yiisoft/yii2-bootstrap": "dev-master",
"yiisoft/yii2-debug": "dev-master",
"yiisoft/yii2-gii": "dev-master"
}, },
"scripts": { "scripts": {
"post-create-project-cmd": [ "post-create-project-cmd": [

2
apps/basic/config/console.php

@ -6,7 +6,7 @@ return [
'preload' => ['log'], 'preload' => ['log'],
'controllerPath' => dirname(__DIR__) . '/commands', 'controllerPath' => dirname(__DIR__) . '/commands',
'controllerNamespace' => 'app\commands', 'controllerNamespace' => 'app\commands',
'extensions' => require(__DIR__ . '/../vendor/yii-extensions.php'), 'extensions' => require(__DIR__ . '/../vendor/yiisoft/extensions.php'),
'components' => [ 'components' => [
'cache' => [ 'cache' => [
'class' => 'yii\caching\FileCache', 'class' => 'yii\caching\FileCache',

2
apps/basic/config/web.php

@ -3,7 +3,7 @@ $params = require(__DIR__ . '/params.php');
$config = [ $config = [
'id' => 'bootstrap', 'id' => 'bootstrap',
'basePath' => dirname(__DIR__), 'basePath' => dirname(__DIR__),
'extensions' => require(__DIR__ . '/../vendor/yii-extensions.php'), 'extensions' => require(__DIR__ . '/../vendor/yiisoft/extensions.php'),
'components' => [ 'components' => [
'request' => [ 'request' => [
'enableCsrfValidation' => true, 'enableCsrfValidation' => true,

11
apps/basic/controllers/SiteController.php

@ -16,14 +16,9 @@ class SiteController extends Controller
return [ return [
'access' => [ 'access' => [
'class' => AccessControl::className(), 'class' => AccessControl::className(),
'only' => ['login', 'logout'], 'only' => ['logout'],
'rules' => [ 'rules' => [
[ [
'actions' => ['login'],
'allow' => true,
'roles' => ['?'],
],
[
'actions' => ['logout'], 'actions' => ['logout'],
'allow' => true, 'allow' => true,
'roles' => ['@'], 'roles' => ['@'],
@ -59,6 +54,10 @@ class SiteController extends Controller
public function actionLogin() public function actionLogin()
{ {
if (!\Yii::$app->user->isGuest) {
$this->goHome();
}
$model = new LoginForm(); $model = new LoginForm();
if ($model->load($_POST) && $model->login()) { if ($model->load($_POST) && $model->login()) {
return $this->goBack(); return $this->goBack();

2
apps/basic/views/layouts/main.php

@ -5,7 +5,7 @@ use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs; use yii\widgets\Breadcrumbs;
/** /**
* @var $this \yii\base\View * @var $this \yii\web\View
* @var $content string * @var $content string
*/ */
app\config\AppAsset::register($this); app\config\AppAsset::register($this);

2
apps/basic/views/site/about.php

@ -2,7 +2,7 @@
use yii\helpers\Html; use yii\helpers\Html;
/** /**
* @var yii\base\View $this * @var yii\web\View $this
*/ */
$this->title = 'About'; $this->title = 'About';
$this->params['breadcrumbs'][] = $this->title; $this->params['breadcrumbs'][] = $this->title;

2
apps/basic/views/site/contact.php

@ -4,7 +4,7 @@ use yii\widgets\ActiveForm;
use yii\captcha\Captcha; use yii\captcha\Captcha;
/** /**
* @var yii\base\View $this * @var yii\web\View $this
* @var yii\widgets\ActiveForm $form * @var yii\widgets\ActiveForm $form
* @var app\models\ContactForm $model * @var app\models\ContactForm $model
*/ */

2
apps/basic/views/site/error.php

@ -3,7 +3,7 @@
use yii\helpers\Html; use yii\helpers\Html;
/** /**
* @var yii\base\View $this * @var yii\web\View $this
* @var string $name * @var string $name
* @var string $message * @var string $message
* @var Exception $exception * @var Exception $exception

2
apps/basic/views/site/index.php

@ -1,6 +1,6 @@
<?php <?php
/** /**
* @var yii\base\View $this * @var yii\web\View $this
*/ */
$this->title = 'My Yii Application'; $this->title = 'My Yii Application';
?> ?>

2
apps/basic/views/site/login.php

@ -3,7 +3,7 @@ use yii\helpers\Html;
use yii\widgets\ActiveForm; use yii\widgets\ActiveForm;
/** /**
* @var yii\base\View $this * @var yii\web\View $this
* @var yii\widgets\ActiveForm $form * @var yii\widgets\ActiveForm $form
* @var app\models\LoginForm $model * @var app\models\LoginForm $model
*/ */

4
apps/benchmark/LICENSE.md

@ -1,7 +1,7 @@
The Yii framework is free software. It is released under the terms of The Yii framework is free software. It is released under the terms of
the following BSD License. the following BSD License.
Copyright © 2008-2013 by Yii Software LLC (http://www.yiisoft.com) Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com)
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
@ -29,4 +29,4 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.

2
docs/api/db/ActiveRecord.md

@ -1,6 +1,6 @@
ActiveRecord implements the [Active Record design pattern](http://en.wikipedia.org/wiki/Active_record). ActiveRecord implements the [Active Record design pattern](http://en.wikipedia.org/wiki/Active_record).
The idea is that an ActiveRecord object is associated with a row in a database table The idea is that an ActiveRecord object is associated with a row in a database table
so object properties are mapped to colums of the corresponding database row. so object properties are mapped to columns of the corresponding database row.
For example, a `Customer` object is associated with a row in the `tbl_customer` For example, a `Customer` object is associated with a row in the `tbl_customer`
table. Instead of writing raw SQL statements to access the data in the table, table. Instead of writing raw SQL statements to access the data in the table,
you can call intuitive methods available in the corresponding ActiveRecord class you can call intuitive methods available in the corresponding ActiveRecord class

16
docs/guide/authentication.md

@ -1,12 +1,10 @@
Authentication Authentication
============== ==============
Authentication is basically what happens when one is trying to sign in. Typically login and passwords are read from Authentication is the act of verifying who a user is, and is the basis of the login process. Typically, authentication uses an identifier--a username or email address--and password, submitted through a form. The application then compares this information against that previously stored.
the form and then application checks if there's such user with such password.
In Yii all this is done semi-automatically and what's left to developer is to implement [[\yii\web\IdentityInterface]]. In Yii all this is done semi-automatically, leaving the developer to merely implement [[\yii\web\IdentityInterface]]. Typically, implementation is accomplished using the `User` model. You can find a full featured example in the
Typically it is being implemented in `User` model. You can find a full featured example in [advanced application template](installation.md). Below only the interface methods are listed:
[advanced application template](installation.md). Below only interface methods are listed:
```php ```php
class User extends ActiveRecord implements IdentityInterface class User extends ActiveRecord implements IdentityInterface
@ -51,10 +49,8 @@ class User extends ActiveRecord implements IdentityInterface
} }
``` ```
First two methods are simple. `findIdentity` given ID returns model instance while `getId` returns ID itself. Two of the outlined methods are simple: `findIdentity` is provided with an ID and returns a model instance represented by that ID. The `getId` method returns the ID itself.
`getAuthKey` and `validateAuthKey` are used to provide extra security to the "remember me" cookie. Two of the other methods--`getAuthKey` and `validateAuthKey`--are used to provide extra security to the "remember me" cookie. `getAuthKey` should return a string that is unique for each user. A good idea is to save this value when the user is created by using Yii's `Security::generateRandomKey()`:
`getAuthKey` should return a string that is unique for each user. A good idea is to save this value when user is
created using `Security::generateRandomKey()`:
```php ```php
public function beforeSave($insert) public function beforeSave($insert)
@ -69,4 +65,4 @@ public function beforeSave($insert)
} }
``` ```
`validateAuthKey` just compares `$authKey` passed as parameter (got from cookie) with the value got from database. The `validateAuthKey` method just compares the `$authKey` variable, passed as parameter (itself retrieved from a cookie), with the value fetched from database.

2
docs/guide/authorization.md

@ -7,7 +7,7 @@ of controlling it.
Access control basics Access control basics
--------------------- ---------------------
Basic acces control is very simple to implement using [[\yii\web\AccessControl]]: Basic access control is very simple to implement using [[\yii\web\AccessControl]]:
```php ```php
class SiteController extends Controller class SiteController extends Controller

50
docs/guide/composer.md

@ -1,20 +1,28 @@
Composer Composer
======== ========
Yii2 uses Composer as its package manager. It is a PHP utility that allows you to automatically install libraries and Yii2 uses Composer as its package manager. Composer is a PHP utility that can automatically handle the installation of needed libraries and
extensions keeping them up to date and handling dependencies. extensions, thereby keeping those third-party resources up to date while absolving you of the need to manually manage the project's dependencies.
Installing Composer Installing Composer
------------------- -------------------
Check the official guide for [linux](http://getcomposer.org/doc/00-intro.md#installation-nix) or In order to install Composer, check the official guide for your operating system:
[Windows](http://getcomposer.org/doc/00-intro.md#installation-windows).
* [Linux](http://getcomposer.org/doc/00-intro.md#installation-nix)
* [Windows](http://getcomposer.org/doc/00-intro.md#installation-windows)
All of the details can be found in the guide, but you'll either download Composer directly from [http://getcomposer.org/](http://getcomposer.org/), or run the following command:
```
curl -s http://getcomposer.org/installer | php
```
Adding more packages to your project Adding more packages to your project
------------------------------------ ------------------------------------
After [installing an application](installing.md) you will find `composer.json` in the root directory of your project. The act of [installing a Yii application](installing.md) creates the `composer.json` file in the root directory of your project.
This file lists packages that your application uses. The part we're interested in is `require` section. In this file you list the packages that your application requires. For Yii sites, the most important part of the file is `require` the section:
``` ```
{ {
@ -25,23 +33,41 @@ This file lists packages that your application uses. The part we're interested i
} }
``` ```
Here you can specify package name and version. Additionally to Yii extensions you may check Within the `require` section, you specify the name and version of each required package. The above example says that a version greater than or equal to 1.3 of Michaelf's PHP-Markdown package is required, as is version 4.5 or greater of Ezyang's HTMLPurifier. For details of this syntax, see the [official Composer documentation](http://getcomposer.org).
[packagist](http://packagist.org/) repository for general purpose PHP packages.
The full list of available Composer-supported PHP packages can be found at [packagist](http://packagist.org/). Any Yii extension can also be explicitly named using the syntax:
After packages are specified you can type either ???
Once you have edited the `composer.json`, you can invoke Composer to install the identified dependencies. For the first installation of the dependencies, use this command:
``` ```
php composer.phar install php composer.phar install
``` ```
or This must be executed within your Yii project's directory, where the `composer.json` file can be found. Depending upon your operating system and setup, you may need to provide paths to the PHP executable and to the `composer.phar` script.
For an existing installation, you can have Composer update the dependencies using:
``` ```
php composer.phar update php composer.phar update
``` ```
depending if you're doing it for the first time or not. Then, after some waiting, packages will be installed and ready Again, you may need to provide specific path references.
to use. You don't need anything to be configured additionally.
In both cases, after some waiting, the required packages will be installed and ready to use in your Yii application. No additional configuration of those packages will be required.
FAQ
---
### Getting "You must enable the openssl extension to download files via https"
If you're using WAMP check [this answer at StackOverflow](http://stackoverflow.com/a/14265815/1106908).
### Getting "Failed to clone <URL here>, git was not found, check that it is installed and in your Path env."
Either install git or try adding `--prefer-dist` to the end of `install` or `update` command.
See also See also

2
docs/guide/configuration.md

@ -36,7 +36,7 @@ return [
// ... // ...
], ],
'params' => require(__DIR__ . '/params.php'), 'params' => require(__DIR__ . '/params.php'),
); ];
``` ```
In the above array keys are names of application properties. Depending on application type you can check properties of In the above array keys are names of application properties. Depending on application type you can check properties of

11
docs/guide/debugger.md

@ -10,6 +10,17 @@ Installing and configuring
How to use it How to use it
------------- -------------
Add these lines to your config file:
```
'preload' => ['debug'],
'modules' => [
'debug' => ['yii\debug\Module']
]
```
**Watch out: by default the debug module only works when browsing the website from the localhost. If you want to use it on a remote (staging) server, add the parameter allowedIPs to the config to whitelist your IP.**
Creating your own panels Creating your own panels
------------------------ ------------------------

20
docs/guide/form.md

@ -1,12 +1,9 @@
Working with forms Working with forms
================== ==================
The primary way of using forms in Yii is [[\yii\widgets\ActiveForm]]. It should be preferred when you have a model The primary way of using forms in Yii is through [[\yii\widgets\ActiveForm]]. This approach should be preferred when the form is based upon a model. Additionally, there are some useful methods in [[\yii\helpers\Html]] that are typically used for adding buttons and help text to any form.
behind a form. Additionally there are some useful methods in [[\yii\helpers\Html]] that are typically used for adding
buttons and help text.
First step creating a form is to create a model. It can be either Active Record or regular Model. Let's use regular When creating model-based forms, the first step is to define the model itself. The model can be either based upon the Active Record class, or the more generic Model class. For this login example, a generic model will be used:
login model as an example:
```php ```php
use yii\base\Model; use yii\base\Model;
@ -57,7 +54,7 @@ class LoginForm extends Model
} }
``` ```
In controller we're passing model to view where Active Form is used: The controller will pass an instance of that model to the view, wherein the Active Form widget is used:
```php ```php
use yii\helpers\Html; use yii\helpers\Html;
@ -78,14 +75,11 @@ use yii\widgets\ActiveForm;
<?php ActiveForm::end() ?> <?php ActiveForm::end() ?>
``` ```
In the code above `ActiveForm::begin()` not only creates form instance but marks the beginning of the form. All the content In the above code, `ActiveForm::begin()` not only creates a form instance, but also marks the beginning of the form. All of the content
that is located between `ActiveForm::begin()` and `ActiveForm::end()` will be wrapped with appropriate `<form>` tag. placed between `ActiveForm::begin()` and `ActiveForm::end()` will be wrapped within the `<form>` tag. As with any widget, you can specify some options as to how the widget should be configured by passing an array to the `begin` method. In this case, an extra CSS class and identifying ID are passed to be used in the opening `<form>` tag.
Same as with any other widget you can specify some options passing an array to `begin` method. In our case we're adding
extra CSS class and specifying ID that will be used in the tag.
In order to insert a form field along with its label all necessary validation JavaScript we're calling `field` method In order to create a form element in the form, along with the element's label, and any application JavaScript validation, the `field` method of the Active Form widget is called. When the invocation of this method is echoed directly, the result is a regular (text) input. To
and it gives back `\yii\widgets\ActiveField`. It it's echoed directly it creates a regular input. In case you want to customize the output, you can chain additional methods to this call:
customize it you can add a chain of additional methods:
```php ```php
<?= $form->field($model, 'password')->passwordInput() ?> <?= $form->field($model, 'password')->passwordInput() ?>

2
docs/guide/i18n.md

@ -121,7 +121,7 @@ extension. After installing and enabling it you will be able to use extended syn
that allows you to specify formatting style. that allows you to specify formatting style.
Full reference is [available at ICU website](http://icu-project.org/apiref/icu4c/classMessageFormat.html) but since it's Full reference is [available at ICU website](http://icu-project.org/apiref/icu4c/classMessageFormat.html) but since it's
a bit crypric we have our own reference below. a bit cryptic we have our own reference below.
### Numbers ### Numbers

78
docs/guide/installation.md

@ -1,85 +1,83 @@
Installation Installation
============ ============
There are two ways you can install the Yii framework:
* Using [Composer](http://getcomposer.org/)
* Via manual download
Installing via Composer Installing via Composer
----------------------- -----------------------
The recommended way of installing Yii is by using [Composer](http://getcomposer.org/) package manager. If you do not The recommended way to install Yii is to use the [Composer](http://getcomposer.org/) package manager. If you do not already
have it, you may download it from [http://getcomposer.org/](http://getcomposer.org/) or run the following command: have Composer installed, you may download it from [http://getcomposer.org/](http://getcomposer.org/) or run the following command:
``` ```
curl -s http://getcomposer.org/installer | php curl -s http://getcomposer.org/installer | php
``` ```
Yii provides a few ready-to-use application templates. Based on your needs, you may choose one of them to bootstrap For problems or more information, see the official Composer guide:
your project.
* [Linux](http://getcomposer.org/doc/00-intro.md#installation-nix)
* [Windows](http://getcomposer.org/doc/00-intro.md#installation-windows)
There are two application templates available: With Composer installed, you can create a new Yii site using one of Yii's ready-to-use application templates. Based on your needs, choosing the right template can help bootstrap your project.
- [basic](https://github.com/yiisoft/yii2-app-basic) that is just a basic frontend application template. Currently, there are two application templates available:
- [advanced](https://github.com/yiisoft/yii2-app-advanced) that is a set of frontend, backend, console, common
(shared code) and environments support.
Please refer to installation instructions on these pages. To read more about ideas behing these application templates and - [basic](https://github.com/yiisoft/yii2-app-basic), just a basic frontend application template.
proposed usage refer to [basic application template](apps-basic.md) and [advanced application template](apps-advanced.md). - [advanced](https://github.com/yiisoft/yii2-app-advanced), consisting of a frontend, a backend, console resources, common (shared code), and support for environments.
For installation instructions for these templates, see the above linked pages. To read more about ideas behind these application templates and
proposed usage, refer to the [basic application template](apps-basic.md) and [advanced application template](apps-advanced.md) documents.
Installing from zip Installing from zip
------------------- -------------------
Installation from zip mainly involves the following two steps: Installation from a zip file involves two steps:
1. Download Yii Framework from [yiiframework.com](http://www.yiiframework.com/). 1. Downloading the Yii Framework from [yiiframework.com](http://www.yiiframework.com/).
2. Unpack the Yii release file to a Web-accessible directory. 2. Unpacking the downloaded file.
> Tip: Yii does not need to be installed under a Web-accessible directory. > Tip: The Yii framework itself does not need to be installed under a web-accessible directory.
A Yii application has one entry script which is usually the only file that A Yii application has one entry script which is usually the only file that absolutely must be exposed to web users (i.e., placed within the web directory). Other PHP scripts, including those part of the
needs to be exposed to Web users. Other PHP scripts, including those from Yii framework, should be protected from web access to prevent possible exploitation by hackers.
Yii, should be protected from Web access; otherwise they might be exploited
by hackers.
Requirements Requirements
------------ ------------
After installing Yii, you may want to verify that your server satisfies After installing Yii, you may want to verify that your server satisfies
Yii's requirements. You can do so by accessing the requirement checker Yii's requirements. You can do so by running the requirement checker
script via the following URL in a Web browser: script in a web browser.
~~~
http://hostname/path/to/yii/requirements/index.php
~~~
Yii requires PHP 5.4.0, so the server must have PHP 5.4.0 or above installed and 1. Copy the `requirements` folder from the downloaded Yii directory to your web directory.
available to the web server. Yii has been tested with [Apache HTTP server](http://httpd.apache.org/) 2. Access `http://hostname/path/to/yii/requirements/index.php` in your browser.
on Windows and Linux. It may also run on other Web servers and platforms,
provided PHP 5.4 is supported.
Yii 2 requires PHP 5.4.0 or higher. Yii has been tested with the [Apache HTTP server](http://httpd.apache.org/) on Windows and Linux. Yii may also be usable on other web servers and platforms, provided that PHP 5.4 or higher is supported.
Recommended Apache Configuration Recommended Apache Configuration
-------------------------------- --------------------------------
Yii is ready to work with a default Apache web server configuration. Yii is ready to work with a default Apache web server configuration. As a security measure, Yii comes with `.htaccess` files in the Yii framework and application folders to deny access to thoe restricted resources.
The `.htaccess` files in Yii framework and application folders deny
access to the restricted resources. To hide the bootstrap file (usually `index.php`) By default, requests for pages in a Yii-based site go through the boostrap file, usually named `index.php`, and placed in the application's root directory. The result will be URLs in the format `http://hostname/index.php/controller/action/param/value`.
in your URLs you can add `mod_rewrite` instructions to the `.htaccess` file
in your document root or to the virtual host configuration: To hide the bootstrap file in your URLs, add `mod_rewrite` instructions to the `.htaccess` file found in your web document root (or add the instructions to the virtual host configuration in Apache's `httpd.conf` file). The applicable instructions are:
~~~ ~~~
RewriteEngine on RewriteEngine on
# if a directory or a file exists, use it directly # If a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php # Otherwise forward it to index.php
RewriteRule . index.php RewriteRule . index.php
~~~ ~~~
Recommended Nginx Configuration Recommended Nginx Configuration
------------------------------- -------------------------------
You can use Yii with [Nginx](http://wiki.nginx.org/) and PHP with [FPM SAPI](http://php.net/install.fpm). Yii can also be used with the popular [Nginx](http://wiki.nginx.org/) web server, so long it has PHP installed as an [FPM SAPI](http://php.net/install.fpm). Below is a sample host configuration for a Yii-based site on Nginx. The configuration identifies tells the server to send all requests for non-existent resources through the bootstrap file, resulting in "prettier" URLs without the need for `index.php` references.
Here is a sample host configuration. It defines the bootstrap file and makes
Yii to catch all requests to nonexistent files, which allows us to have nice-looking URLs.
~~~ ~~~
server { server {
@ -107,4 +105,4 @@ server {
} }
~~~ ~~~
Make sure to set `cgi.fix_pathinfo=0` in php.ini to avoid many unnecessary system `stat()` calls. When using this configuration, you should set `cgi.fix_pathinfo=0` in the `php.ini` file in order to avoid many unnecessary system `stat()` calls.

61
docs/guide/mvc.md

@ -2,17 +2,17 @@ MVC Overview
============ ============
Yii implements the model-view-controller (MVC) design pattern, which is Yii implements the model-view-controller (MVC) design pattern, which is
widely adopted in Web programming. MVC aims to separate business logic from widely adopted in web and other application programming. MVC aims to separate business logic from
user interface considerations, so that developers can more easily change user interface considerations, allowing developers to more easily change individual components of an application without affecting, or even touching, another.
each part without affecting the other. In MVC, the model represents the
information (the data) and the business rules; the view contains elements In MVC, the *model* represents the
of the user interface such as text, form inputs; and the controller manages information (the data) and the business rules to which the data must adhere. The *view* contains elements
the communication between the model and the view. of the user interface, such as text, images, and form elements. The *controller* manages
the communication between the model and the view, acting as an agent.
Besides implementing MVC, Yii also introduces a front-controller, called
`application`, which encapsulates the execution context for the processing Besides implementing the MVC design pattern, Yii also introduces a *front-controller*, called
of a request. Application collects information about a user request and `application`. The front-controller encapsulates the *execution context* for the processing of a request. This means that the front-controller collects information about a user request, and
then dispatches it to an appropriate controller for further handling. then dispatches it to an appropriate controller for actual handling of that request. In other words, the front-controller is the primary application manager, handling all requests and delegating action accordingly.
The following diagram shows the static structure of a Yii application: The following diagram shows the static structure of a Yii application:
@ -22,31 +22,20 @@ The following diagram shows the static structure of a Yii application:
A Typical Workflow A Typical Workflow
------------------ ------------------
The following diagram shows a typical workflow of a Yii application when The following diagram shows a typical workflow of a Yii application handling a user request:
it is handling a user request:
![Typical workflow of a Yii application](flow.png) ![Typical workflow of a Yii application](flow.png)
1. A user makes a request with the URL `http://www.example.com/index.php?r=post/show&id=1` 1. A user makes a request of the URL `http://www.example.com/index.php?r=post/show&id=1`. The Web server handles the request by executing the bootstrap script `index.php`.
and the Web server handles the request by executing the bootstrap script `index.php`. 2. The bootstrap script creates an [Application](/doc/guide/basics.application) instance and runs it.
2. The bootstrap script creates an [Application](/doc/guide/basics.application) 3. The Application instance obtains the detailed user request information from an [application component](/doc/guide/basics.application#application-component) named `request`.
instance and runs it. 4. The application determines which [controller](/doc/guide/basics.controller) and which [action](/doc/guide/basics.controller#action) of that controller was requested. This is accomplished with the help
3. The Application obtains detailed user request information from of an application component named `urlManager`. For this example, the controller is `post`, which refers to the `PostController` class; and the action is `show`, whose actual meaning is determined by the controller.
an [application component](/doc/guide/basics.application#application-component) 5. The application creates an instance of the requested controller
named `request`. to further handle the user request. The controller determines that the action `show` refers to a method named `actionShow` in the controller class. It then creates and executes filters (e.g. access control, benchmarking) associated with this action. The action is then executed, if execution is allowed by the filters (e.g., if the user has permission to execute that action).
4. The application determines the requested [controller](/doc/guide/basics.controller) 6. The action creates a `Post` [model](/doc/guide/basics.model) instance, using the underlying database table, where the ID value of the corresponding record `1`.
and [action](/doc/guide/basics.controller#action) with the help 7. The action renders a [view](/doc/guide/basics.view) named `show`, providing to the view the `Post` model instance.
of an application component named `urlManager`. For this example, the controller 8. The view reads the attributes of the `Post` model instance and displays the values of those attributes.
is `post`, which refers to the `PostController` class; and the action is `show`, 9. The view executes some [widgets](/doc/guide/basics.view#widget).
whose actual meaning is determined by the controller. 10. The view rendering result--the output from the previous steps--is embedded in a [layout](/doc/guide/basics.view#layout) to create a complete page.
5. The application creates an instance of the requested controller 11. The action completes the view rendering and displays the result to the user.
to further handle the user request. The controller determines that the action
`show` refers to a method named `actionShow` in the controller class. It then
creates and executes filters (e.g. access control, benchmarking) associated
with this action. The action is executed if it is allowed by the filters.
6. The action reads a `Post` [model](/doc/guide/basics.model) whose ID is `1` from the database.
7. The action renders a [view](/doc/guide/basics.view) named `show` with the `Post` model.
8. The view reads and displays the attributes of the `Post` model.
9. The view executes some [widgets](/doc/guide/basics.view#widget).
10. The view rendering result is embedded in a [layout](/doc/guide/basics.view#layout).
11. The action completes the view rendering and displays the result to the user.

2
docs/guide/query-builder.md

@ -45,7 +45,7 @@ $query->select(['tbl_user.name AS author', 'tbl_post.title as title']) // <-- sp
->leftJoin('tbl_post', 'tbl_post.user_id = tbl_user.id'); // <-- join with another table ->leftJoin('tbl_post', 'tbl_post.user_id = tbl_user.id'); // <-- join with another table
``` ```
In the code above we've used `leftJoin` method to select from two related tables at the same time. Firsrt parameter In the code above we've used `leftJoin` method to select from two related tables at the same time. First parameter
specifies table name and the second is the join condition. Query builder has the following methods to join tables: specifies table name and the second is the join condition. Query builder has the following methods to join tables:
- `innerJoin` - `innerJoin`

8
docs/guide/security.md

@ -1,6 +1,8 @@
Security Security
======== ========
Good security is vital to the health and success of many websites. Unfortunately, many developers may cut corners when it comes to security due to a lack of understanding or too large of an implementation hurdle. To make your Yii-based site as secure as possible, the Yii framework has baked in several excellent, and easy to use, security features.
Hashing and verifying passwords Hashing and verifying passwords
------------------------------ ------------------------------
@ -28,7 +30,7 @@ if (Security::validatePassword($password, $hash)) {
``` ```
Random data Creating random data
----------- -----------
Random data is useful in many cases. For example, when resetting a password via email you need to generate a token, Random data is useful in many cases. For example, when resetting a password via email you need to generate a token,
@ -63,9 +65,11 @@ Then when user want to read it:
$data = \yii\helpers\Security::decrypt($encryptedData, $secretWord); $data = \yii\helpers\Security::decrypt($encryptedData, $secretWord);
``` ```
Making sure data wasn't modified Confirming data integrity
-------------------------------- --------------------------------
Making sure data wasn't modified
hashData() hashData()
validateData() validateData()

2
docs/guide/template.md

@ -10,7 +10,7 @@ a custom template engines by reconfiguring this component's behavior:
[ [
'components' => [ 'components' => [
'view' => [ 'view' => [
'class' => 'yii\base\View', 'class' => 'yii\web\View',
'renderers' => [ 'renderers' => [
'tpl' => [ 'tpl' => [
'class' => 'yii\renderers\SmartyViewRenderer', 'class' => 'yii\renderers\SmartyViewRenderer',

48
docs/guide/url.md

@ -1,57 +1,61 @@
URL Management URL Management
============== ==============
The concept of URL management in Yii fairly simple. The idea is that application uses internal routes and parameters The concept of URL management in Yii fairly simple. URL management is based on the premise that the application uses internal routes and parameters
everywhere. Framework takes care of translating routes into URLs and back according to URL manager configuration. everywhere. The framework itself will then translates routes into URLs, and translate URLs into routs, according to the URL manager's configuration.
This approach allows you to adjust URLs in a single config file without touching application code. This approach allows you to change site-wide URLs merely by edited a single config file, without ever touching the application code.
Internal route Internal route
-------------- --------------
Internal routes and parameters are what you're dealing with when implementing an application using Yii. When implementing an application using Yii, you'll deal with internal routes and parameters. Each controller and controller action has a corresponding internal route, such as `site/index` or `user/create`. In the former, `site` is referred to as the *controller ID* while `index` is referred to as the *action ID*. In the second example, `user` is the controller ID and `create` is the action ID. If controller belongs to a *module*, the internal route is prefixed with the module ID, such as `blog/post/index` for a blog module (with `post` being the controller ID and `index` being the action ID).
Each controller and its action has a corresponding internal route such as `site/index`. Here `site` is referred to as
controller ID while `index` is referred to as action ID. If controller belongs to a module, internal route is prefixed
with the module ID such as `blog/post/index` for a blog module.
Creating URLs Creating URLs
------------- -------------
As was already mentioned, the most important rule is to always use URL manager to create URLs. Url manages is an The most important rule for creating URLs in your site is to always do so using the URL manager. The URL manager is an
application component with `urlManager` id that is accessible both from web and console applications via application component with the `urlManager` ID. This component is accessible both from web and console applications via
`\Yii::$app->urlManager` and has two following URL creation methods available: `\Yii::$app->urlManager`. The component makes availabe the two following URL creation methods:
- createUrl($route, $params = []) - `createUrl($route, $params = [])`
- createAbsoluteUrl($route, $params = []) - `createAbsoluteUrl($route, $params = [])`
First one creates URL relative to the application root while the second one creates URL prefixed with protocol and The `createUrl` method creates a URL relative to the application root, such as `/index.php/site/index/`. The `createAbsoluteUrl` method creates URL prefixed with the proper protocol and
hostname. The former is suitable for internal application URLs while the latter is used when you need to create rules hostname: `http://www.example.com/index.php/site/index`. The former is suitable for internal application URLs, while the latter is used when you need to create rules for outside the website, such as when sending emails or generating an RSS feed.
for outside the website. For example, when sending emails or generating RSS feed.
Some examples: Some examples:
```php ```php
echo \Yii::$app->urlManager->createUrl('site/page', ['id' => 'about']); echo \Yii::$app->urlManager->createUrl('site/page', ['id' => 'about']);
// /index.php/site/page/id/about/
echo \Yii::$app->urlManager->createAbsoluteUrl('blog/post/index'); echo \Yii::$app->urlManager->createAbsoluteUrl('blog/post/index');
// http://www.example.com/index.php/blog/post/index/
``` ```
Inside web application controller you can use its own `createUrl` shortcut method in the following forms: The exact format of the outputted URL will depend upon how the URL manager is configured (which is the point). The above examples may also output:
* `/site/page/id/about/`
* `/index.php?r=site/page&id=about`
* `http://www.example.com/blog/post/index/`
* `http://www.example.com/index.php?r=blog/post/index`
Inside a web application controller, you can use the controller's own `createUrl` shortcut method. Unlike the global `createUrl` method, the controller version is context sensitive:
```php ```php
echo $this->createUrl(''); // currently active route echo $this->createUrl(''); // currently active route
echo $this->createUrl('view', ['id' => 'contact']); // same controller, different action echo $this->createUrl('view', ['id' => 'contact']); // same controller, different action
echo $this->createUrl('post/index'); // same module, different controller and action echo $this->createUrl('post/index'); // same module, different controller and action
echo $this->createUrl('/site/index'); // absolute route no matter which controller we're in echo $this->createUrl('/site/index'); // absolute route no matter what controller is making this call
``` ```
> **Tip**: In order to generate URL with a hashtag, for example `/index.php?r=site/page&id=100#title`, you need to > **Tip**: In order to generate URL with a hashtag, for example `/index.php?r=site/page&id=100#title`, you need to
specify parameter named `#` using `$this->createUrl('post/read', ['id' => 100, '#' => 'title'])`. specify the parameter named `#` using `$this->createUrl('post/read', ['id' => 100, '#' => 'title'])`.
Customizing URLs Customizing URLs
---------------- ----------------
By default Yii uses a query string format URLs such as `/index.php?r=news/view&id=100`. In order to make URLs By default, Yii uses a query string format for URLs, such as `/index.php?r=news/view&id=100`. In order to make URLs
human-friendly you need to configure `urlManager` component like the following: human-friendly (i.e., more readable), you need to configure the `urlManager` component in the application's configuration file. Enabling "pretty" URLs will convert the query string format to a directory-based format: `/index.php/news/view/id/100`. Disabling the `showScriptName` parameter means that `index.php` will not be part of the URLs. Here's the relevant part of the application's configuration file.
```php ```php
<?php <?php
@ -66,7 +70,7 @@ return [
]; ];
``` ```
Note that Note that this configuration will only work if the web server has been properly configured for Yii, see (installation)[installation.md#recommended-apache-configuration].
### Named parameters ### Named parameters

2
docs/guide/validation.md

@ -8,7 +8,7 @@ Standard Yii validators
----------------------- -----------------------
Standard Yii validators could be specified using aliases instead of referring to class names. Here's the list of all Standard Yii validators could be specified using aliases instead of referring to class names. Here's the list of all
validators budled with Yii with their most useful properties: validators bundled with Yii with their most useful properties:
### `boolean`: [[BooleanValidator]] ### `boolean`: [[BooleanValidator]]

6
docs/guide/view.md

@ -38,7 +38,7 @@ Widgets
Widgets are a self-contained building blocks for your views. A widget may contain advanced logic, typically takes some Widgets are a self-contained building blocks for your views. A widget may contain advanced logic, typically takes some
configuration and data and returns HTML. There is a good number of widgets bundled with Yii such as [active form](form.md), configuration and data and returns HTML. There is a good number of widgets bundled with Yii such as [active form](form.md),
breadcrumbs, menu or [wrappers around bootstrap component framework](boostrap-widgets.md). Additionally there are breadcrumbs, menu or [wrappers around bootstrap component framework](bootstrap-widgets.md). Additionally there are
extensions providing additional widgets such as official one for jQueryUI components. extensions providing additional widgets such as official one for jQueryUI components.
In order to use widget you need to do the following: In order to use widget you need to do the following:
@ -113,7 +113,7 @@ to learn more refer to [Using template engines](template.md) section of the guid
Using View object in templates Using View object in templates
------------------------------ ------------------------------
An instance of `yii\base\View` component is available in view templates as `$this` variable. Using it in templates you An instance of `yii\web\View` component is available in view templates as `$this` variable. Using it in templates you
can do many useful things including setting page title and meta, registering scripts and accessing the context. can do many useful things including setting page title and meta, registering scripts and accessing the context.
### Setting page title ### Setting page title
@ -342,7 +342,7 @@ Customizing View component
-------------------------- --------------------------
Since view is also an application component named `view` you can replace it with your own component that extends Since view is also an application component named `view` you can replace it with your own component that extends
from `yii\base\View`. It can be done via application configuration file such as `config/web.php`: from `yii\base\View` or `yii\web\View`. It can be done via application configuration file such as `config/web.php`:
```php ```php
return [ return [

0
framework/yii/bootstrap/Alert.php → extensions/bootstrap/Alert.php

2
framework/yii/bootstrap/BootstrapAsset.php → extensions/bootstrap/BootstrapAsset.php

@ -15,7 +15,7 @@ use yii\web\AssetBundle;
*/ */
class BootstrapAsset extends AssetBundle class BootstrapAsset extends AssetBundle
{ {
public $sourcePath = '@yii/bootstrap/assets'; public $sourcePath = '@vendor/twbs/bootstrap/dist';
public $css = [ public $css = [
'css/bootstrap.css', 'css/bootstrap.css',
]; ];

2
framework/yii/bootstrap/BootstrapPluginAsset.php → extensions/bootstrap/BootstrapPluginAsset.php

@ -16,7 +16,7 @@ use yii\web\AssetBundle;
*/ */
class BootstrapPluginAsset extends AssetBundle class BootstrapPluginAsset extends AssetBundle
{ {
public $sourcePath = '@yii/bootstrap/assets'; public $sourcePath = '@vendor/twbs/bootstrap/dist';
public $js = [ public $js = [
'js/bootstrap.js', 'js/bootstrap.js',
]; ];

2
framework/yii/bootstrap/BootstrapThemeAsset.php → extensions/bootstrap/BootstrapThemeAsset.php

@ -17,7 +17,7 @@ use yii\web\AssetBundle;
*/ */
class BootstrapThemeAsset extends AssetBundle class BootstrapThemeAsset extends AssetBundle
{ {
public $sourcePath = '@yii/bootstrap/assets'; public $sourcePath = '@vendor/twbs/bootstrap/dist';
public $css = [ public $css = [
'css/bootstrap-theme.css', 'css/bootstrap-theme.css',
]; ];

0
framework/yii/bootstrap/Button.php → extensions/bootstrap/Button.php

0
framework/yii/bootstrap/ButtonDropdown.php → extensions/bootstrap/ButtonDropdown.php

0
framework/yii/bootstrap/ButtonGroup.php → extensions/bootstrap/ButtonGroup.php

0
framework/yii/bootstrap/Carousel.php → extensions/bootstrap/Carousel.php

0
framework/yii/bootstrap/Collapse.php → extensions/bootstrap/Collapse.php

0
framework/yii/bootstrap/Dropdown.php → extensions/bootstrap/Dropdown.php

0
framework/yii/bootstrap/Modal.php → extensions/bootstrap/Modal.php

0
framework/yii/bootstrap/Nav.php → extensions/bootstrap/Nav.php

0
framework/yii/bootstrap/NavBar.php → extensions/bootstrap/NavBar.php

0
framework/yii/bootstrap/Progress.php → extensions/bootstrap/Progress.php

32
extensions/bootstrap/README.md

@ -0,0 +1,32 @@
Twitter Bootstrap Extension for Yii 2
=====================================
This is the Twitter Bootstrap extension for Yii 2. It encapsulates Bootstrap components
and plugins in terms of Yii widgets, and thus makes using Bootstrap components/plugins
in Yii applications extremely easy. For example, the following
single line of code in a view file would render a Bootstrap Progress plugin:
```php
<?= yii\bootstrap\Progress::widget(['percent' => 60, 'label' => 'test']) ?>
```
Installation
------------
The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
Either run
```
php composer.phar require yiisoft/yii2-bootstrap "*"
```
or add
```
"yiisoft/yii2-bootstrap": "*"
```
to the require section of your `composer.json` file.

0
framework/yii/bootstrap/Tabs.php → extensions/bootstrap/Tabs.php

0
framework/yii/bootstrap/Widget.php → extensions/bootstrap/Widget.php

20
extensions/mutex/composer.json → extensions/bootstrap/composer.json

@ -1,7 +1,7 @@
{ {
"name": "yiisoft/yii2-mutex", "name": "yiisoft/yii2-bootstrap",
"description": "Mutual exclusion extension for the Yii framework", "description": "The Twitter Bootstrap extension for the Yii framework",
"keywords": ["yii", "mutex"], "keywords": ["yii", "bootstrap"],
"type": "yii2-extension", "type": "yii2-extension",
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"support": { "support": {
@ -11,17 +11,13 @@
"irc": "irc://irc.freenode.net/yii", "irc": "irc://irc.freenode.net/yii",
"source": "https://github.com/yiisoft/yii2" "source": "https://github.com/yiisoft/yii2"
}, },
"authors": [
{
"name": "resurtm",
"email": "resurtm@gmail.com"
}
],
"minimum-stability": "dev", "minimum-stability": "dev",
"require": { "require": {
"yiisoft/yii2": "*" "yiisoft/yii2": "*",
"twbs/bootstrap": "3.0.*"
}, },
"autoload": { "autoload": {
"psr-0": { "yii\\mutex\\": "" } "psr-0": { "yii\\bootstrap\\": "" }
} },
"target-dir": "yii/bootstrap"
} }

60
extensions/composer/yii/composer/Installer.php → extensions/composer/Installer.php

@ -11,6 +11,7 @@ use Composer\Package\PackageInterface;
use Composer\Installer\LibraryInstaller; use Composer\Installer\LibraryInstaller;
use Composer\Repository\InstalledRepositoryInterface; use Composer\Repository\InstalledRepositoryInterface;
use Composer\Script\CommandEvent; use Composer\Script\CommandEvent;
use Composer\Util\Filesystem;
/** /**
* @author Qiang Xue <qiang.xue@gmail.com> * @author Qiang Xue <qiang.xue@gmail.com>
@ -22,6 +23,8 @@ class Installer extends LibraryInstaller
const EXTRA_WRITABLE = 'writable'; const EXTRA_WRITABLE = 'writable';
const EXTRA_EXECUTABLE = 'executable'; const EXTRA_EXECUTABLE = 'executable';
const EXTENSION_FILE = 'yiisoft/extensions.php';
/** /**
* @inheritdoc * @inheritdoc
*/ */
@ -65,8 +68,11 @@ class Installer extends LibraryInstaller
'version' => $package->getVersion(), 'version' => $package->getVersion(),
]; ];
$alias = $this->generateDefaultAlias($package);
if (!empty($alias)) {
$extension['alias'] = $alias;
}
$extra = $package->getExtra(); $extra = $package->getExtra();
if (isset($extra[self::EXTRA_BOOTSTRAP]) && is_string($extra[self::EXTRA_BOOTSTRAP])) { if (isset($extra[self::EXTRA_BOOTSTRAP]) && is_string($extra[self::EXTRA_BOOTSTRAP])) {
$extension['bootstrap'] = $extra[self::EXTRA_BOOTSTRAP]; $extension['bootstrap'] = $extra[self::EXTRA_BOOTSTRAP];
} }
@ -76,6 +82,30 @@ class Installer extends LibraryInstaller
$this->saveExtensions($extensions); $this->saveExtensions($extensions);
} }
protected function generateDefaultAlias(PackageInterface $package)
{
$autoload = $package->getAutoload();
if (empty($autoload['psr-0'])) {
return false;
}
$fs = new Filesystem;
$vendorDir = $fs->normalizePath($this->vendorDir);
$aliases = [];
foreach ($autoload['psr-0'] as $name => $path) {
$name = str_replace('\\', '/', trim($name, '\\'));
if (!$fs->isAbsolutePath($path)) {
$path = $this->vendorDir . '/' . $package->getName() . '/' . $path;
}
$path = $fs->normalizePath($path);
if (strpos($path . '/', $vendorDir . '/') === 0) {
$aliases["@$name"] = '<vendor-dir>' . substr($path, strlen($vendorDir)) . '/' . $name;
} else {
$aliases["@$name"] = $path . '/' . $name;
}
}
return $aliases;
}
protected function removePackage(PackageInterface $package) protected function removePackage(PackageInterface $package)
{ {
$packages = $this->loadExtensions(); $packages = $this->loadExtensions();
@ -85,14 +115,34 @@ class Installer extends LibraryInstaller
protected function loadExtensions() protected function loadExtensions()
{ {
$file = $this->vendorDir . '/yii-extensions.php'; $file = $this->vendorDir . '/' . self::EXTENSION_FILE;
return is_file($file) ? require($file) : []; if (!is_file($file)) {
return [];
}
$extensions = require($file);
$vendorDir = str_replace('\\', '/', $this->vendorDir);
$n = strlen($vendorDir);
foreach ($extensions as &$extension) {
if (isset($extension['alias'])) {
foreach ($extension['alias'] as $alias => $path) {
$path = str_replace('\\', '/', $path);
if (strpos($path . '/', $vendorDir . '/') === 0) {
$extension['alias'][$alias] = '<vendor-dir>' . substr($path, $n);
}
}
}
}
return $extensions;
} }
protected function saveExtensions(array $extensions) protected function saveExtensions(array $extensions)
{ {
$file = $this->vendorDir . '/yii-extensions.php'; $file = $this->vendorDir . '/' . self::EXTENSION_FILE;
file_put_contents($file, "<?php\nreturn " . var_export($extensions, true) . ";\n"); $array = str_replace("'<vendor-dir>", '$vendorDir . \'', var_export($extensions, true));
file_put_contents($file, "<?php\n\n\$vendorDir = dirname(__DIR__);\n\nreturn $array;\n");
} }

2
extensions/composer/LICENSE.md

@ -1,7 +1,7 @@
The Yii framework is free software. It is released under the terms of The Yii framework is free software. It is released under the terms of
the following BSD License. the following BSD License.
Copyright © 2008-2013 by Yii Software LLC (http://www.yiisoft.com) Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com)
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without

5
extensions/composer/yii/composer/Plugin.php → extensions/composer/Plugin.php

@ -26,9 +26,10 @@ class Plugin implements PluginInterface
{ {
$installer = new Installer($io, $composer); $installer = new Installer($io, $composer);
$composer->getInstallationManager()->addInstaller($installer); $composer->getInstallationManager()->addInstaller($installer);
$file = rtrim($composer->getConfig()->get('vendor-dir'), '/') . '/yii-extensions.php'; $file = rtrim($composer->getConfig()->get('vendor-dir'), '/') . '/yiisoft/extensions.php';
if (!is_file($file)) { if (!is_file($file)) {
file_put_contents($file, "<?php\nreturn [];\n"); @mkdir(dirname($file));
file_put_contents($file, "<?php\n\nreturn [];\n");
} }
} }
} }

91
extensions/composer/README.md

@ -1,44 +1,63 @@
Yii 2.0 Public Preview - Composer Installer Yii 2 Composer Installer
=========================================== ========================
Thank you for choosing Yii - a high-performance component-based PHP framework. This is the composer installer for Yii 2 extensions. It implements a new composer package type named `yii2-extension`,
which should be used by all Yii 2 extensions if they are distributed as composer packages.
If you are looking for a production-ready PHP framework, please use
[Yii v1.1](https://github.com/yiisoft/yii).
Yii 2.0 is still under heavy development. We may make significant changes Usage
without prior notices. **Yii 2.0 is not ready for production use yet.** -----
[![Build Status](https://secure.travis-ci.org/yiisoft/yii2.png)](http://travis-ci.org/yiisoft/yii2) To use Yii 2 composer installer, simply set `type` to be `yii2-extension` in your `composer.json`,
like the following:
This is the yii2 composer installer.
Installation
------------
This extension offers you enhanced Composer handling for your yii2-project. It will therefore require you to use Composer.
```json
{
"type": "yii2-extension",
"require": {
"yiisoft/yii2": "*"
},
...
}
``` ```
php composer.phar require yiisoft/yii2-composer "*"
```
*Note: You might have to run `php composer.phar selfupdate` before using this extension.*
Usage & Documentation You may specify a bootstrap class in the `extra` section. The `init()` method of the class will be executed each time
--------------------- the Yii 2 application is responding to a request. For example,
This extension allows you to hook to certain composer events and automate preparing your Yii2 application for further usage. ```json
{
After the package is installed, the `composer.json` file has to be modified to enable this extension. "type": "yii2-extension",
...,
To see it in action take a look at the example apps in the repository: "extra": {
"bootstrap": "yii\\jui\\Extension"
- [Basic](https://github.com/suralc/yii2/blob/master/apps/basic/composer.json#L27) }
- [Advanced](https://github.com/suralc/yii2/blob/extensions-readme/apps/advanced/composer.json) }
```
However it might be useful to read through the official composer [documentation](http://getcomposer.org/doc/articles/scripts.md)
to understand what this extension can do for you and what it can't.
You can also use this as a template to create your own composer additions to ease development and deployment of your app. The `Installer` class also implements a static method `setPermission()` that can be called after
a Yii 2 projected is installed, through the `post-create-project-cmd` composer script.
The method will set specified directories or files to be writable or executable, depending on
the corresponding parameters set in the `extra` section of the `composer.json` file.
For example,
```json
{
"name": "yiisoft/yii2-app-basic",
"type": "project",
...
"scripts": {
"post-create-project-cmd": [
"yii\\composer\\Installer::setPermission"
]
},
"extra": {
"writable": [
"runtime",
"web/assets"
],
"executable": [
"yii"
]
}
}
```

1
extensions/composer/composer.json

@ -21,6 +21,7 @@
"autoload": { "autoload": {
"psr-0": { "yii\\composer\\": "" } "psr-0": { "yii\\composer\\": "" }
}, },
"target-dir": "yii/composer",
"extra": { "extra": {
"class": "yii\\composer\\Plugin" "class": "yii\\composer\\Plugin"
}, },

0
framework/yii/debug/DebugAsset.php → extensions/debug/DebugAsset.php

0
framework/yii/debug/LogTarget.php → extensions/debug/LogTarget.php

2
framework/yii/debug/Module.php → extensions/debug/Module.php

@ -9,7 +9,7 @@ namespace yii\debug;
use Yii; use Yii;
use yii\base\Application; use yii\base\Application;
use yii\base\View; use yii\web\View;
use yii\web\HttpException; use yii\web\HttpException;
/** /**

0
framework/yii/debug/Panel.php → extensions/debug/Panel.php

46
extensions/debug/README.md

@ -0,0 +1,46 @@
Debug Extension for Yii 2
=========================
This extension provides a debugger for Yii 2 applications. When this extension is used,
a debugger toolbar will appear at the bottom of every page. The extension also provides
a set of standalone pages to display more detailed debug information.
Installation
------------
The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
Either run
```
php composer.phar require yiisoft/yii2-debug "*"
```
or add
```
"yiisoft/yii2-debug": "*"
```
to the require section of your `composer.json` file.
Usage
-----
Once the extension is installed, simply modify your application configuration as follows:
```php
return [
'preload' => ['debug'],
'modules' => [
'debug' => 'yii\debug\Module',
...
],
...
];
```
You will see a debugger toolbar showing at the bottom of every page of your application.
You can click on the toolbar to see more detailed debug information.

0
framework/yii/debug/assets/main.css → extensions/debug/assets/main.css

23
extensions/debug/composer.json

@ -0,0 +1,23 @@
{
"name": "yiisoft/yii2-debug",
"description": "The debugger extension for the Yii framework",
"keywords": ["yii", "debug", "debugger"],
"type": "yii2-extension",
"license": "BSD-3-Clause",
"support": {
"issues": "https://github.com/yiisoft/yii2/issues?state=open",
"forum": "http://www.yiiframework.com/forum/",
"wiki": "http://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii",
"source": "https://github.com/yiisoft/yii2"
},
"minimum-stability": "dev",
"require": {
"yiisoft/yii2": "*",
"yiisoft/yii2-bootstrap": "*"
},
"autoload": {
"psr-0": { "yii\\debug\\": "" }
},
"target-dir": "yii/debug"
}

0
framework/yii/debug/controllers/DefaultController.php → extensions/debug/controllers/DefaultController.php

0
framework/yii/debug/panels/ConfigPanel.php → extensions/debug/panels/ConfigPanel.php

0
framework/yii/debug/panels/DbPanel.php → extensions/debug/panels/DbPanel.php

0
framework/yii/debug/panels/LogPanel.php → extensions/debug/panels/LogPanel.php

0
framework/yii/debug/panels/ProfilingPanel.php → extensions/debug/panels/ProfilingPanel.php

0
framework/yii/debug/panels/RequestPanel.php → extensions/debug/panels/RequestPanel.php

2
framework/yii/debug/views/default/index.php → extensions/debug/views/default/index.php

@ -3,7 +3,7 @@
use yii\helpers\Html; use yii\helpers\Html;
/** /**
* @var \yii\base\View $this * @var \yii\web\View $this
* @var array $manifest * @var array $manifest
*/ */

0
framework/yii/debug/views/default/toolbar.css → extensions/debug/views/default/toolbar.css

0
framework/yii/debug/views/default/toolbar.js → extensions/debug/views/default/toolbar.js

2
framework/yii/debug/views/default/toolbar.php → extensions/debug/views/default/toolbar.php

@ -1,6 +1,6 @@
<?php <?php
/** /**
* @var \yii\base\View $this * @var \yii\web\View $this
* @var \yii\debug\Panel[] $panels * @var \yii\debug\Panel[] $panels
* @var string $tag * @var string $tag
*/ */

2
framework/yii/debug/views/default/view.php → extensions/debug/views/default/view.php

@ -5,7 +5,7 @@ use yii\bootstrap\ButtonGroup;
use yii\helpers\Html; use yii\helpers\Html;
/** /**
* @var \yii\base\View $this * @var \yii\web\View $this
* @var array $summary * @var array $summary
* @var string $tag * @var string $tag
* @var array $manifest * @var array $manifest

2
framework/yii/debug/views/layouts/main.php → extensions/debug/views/layouts/main.php

@ -1,6 +1,6 @@
<?php <?php
/** /**
* @var \yii\base\View $this * @var \yii\web\View $this
* @var string $content * @var string $content
*/ */
use yii\helpers\Html; use yii\helpers\Html;

0
framework/yii/gii/CodeFile.php → extensions/gii/CodeFile.php

2
framework/yii/gii/Generator.php → extensions/gii/Generator.php

@ -11,7 +11,7 @@ use Yii;
use ReflectionClass; use ReflectionClass;
use yii\base\InvalidConfigException; use yii\base\InvalidConfigException;
use yii\base\Model; use yii\base\Model;
use yii\base\View; use yii\web\View;
/** /**

0
framework/yii/gii/GiiAsset.php → extensions/gii/GiiAsset.php

0
framework/yii/gii/Module.php → extensions/gii/Module.php

47
extensions/gii/README.md

@ -0,0 +1,47 @@
Gii Extension for Yii 2
========================
This extension provides a Web-based code generator, called Gii, for Yii 2 applications.
You can use Gii to quickly generate models, forms, modules, CRUD, etc.
Installation
------------
The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
Either run
```
php composer.phar require yiisoft/yii2-gii "*"
```
or add
```
"yiisoft/yii2-gii": "*"
```
to the require section of your `composer.json` file.
Usage
-----
Once the extension is installed, simply modify your application configuration as follows:
```php
return [
'modules' => [
'gii' => 'yii\gii\Module',
...
],
...
];
```
You can then access Gii through the following URL:
```
http://localhost/path/to/index.php?r=gii
```

2
framework/yii/gii/assets/gii.js → extensions/gii/assets/gii.js

@ -14,7 +14,7 @@ yii.gii = (function ($) {
}; };
var initStickyInputs = function () { var initStickyInputs = function () {
$('.sticky:not(.error) input[type="text"],select,textarea').each(function () { $('.sticky:not(.error)').find('input[type="text"],select,textarea').each(function () {
var value; var value;
if (this.tagName === 'SELECT') { if (this.tagName === 'SELECT') {
value = this.options[this.selectedIndex].text; value = this.options[this.selectedIndex].text;

0
framework/yii/gii/assets/logo.png → extensions/gii/assets/logo.png

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save