ただし、現時点では、列車はレールに乗っているだけです(ここにありますが、類似点を探してはいけません)。安定したバージョンを待つ必要があり、新しいプロジェクトを今日行う必要があります。 幸福な開発のために、便利なアプリケーション構造、不必要な問題のない展開、および必要に応じたさまざまな利点のかなり不足しています。 現時点では、最も楽しいソリューションはYiinitializrです。
Yiinitializrは、Yiiフレームワークに基づいたアプリケーションの開発サイクルを簡素化および高速化するのに役立つライブラリです。 すぐに使用できる構造テンプレートのオプションは3つあります:
- 基本-小規模プロジェクト向けに作成。
- 中級-中程度の複雑さのほとんどのプロジェクトに適しています。
- 高度-独自のAPIを提供する必要がある、より複雑なプロジェクトに適しています。
この記事を読む価値があるのはなぜですか? わかりやすいドキュメントがないため、まだ経験の浅い開発者は(自分でテストした)up迷に陥り、さまざまな驚き(たとえば、バグの形で)がこの感情を完全に補完します。 Yiinitializrを使用して作業するプロセスを歯車に分解して、開発の過程で発生するほとんどのトラブルから保護しました。
これについては、説明的な言葉で十分だと思います。 この記事を読んでいるなら、おそらくYiinitializrが何であるかを既に知っているので、その使用に関する特定の質問への回答を得たいと思うでしょう。 まだわからない場合は、要点を見つけてください。あなたが捕まったので、さらに読むことを恐れないでください。
注意! Yiinitializrの開発が(非常にゆっくりではありますが)継続しているため、この記事で説明されているバグや動作は、読む時点で修正または変更できます。 新しい、より高度なツール(たとえば、フレームワークの2番目のバージョンの組み込み機能)が表示されることもあります。
設置
ステップ1. Yiinitializrをダウンロードする
まず最初に、Yiinitializrをダウンロードする必要があります。 これは、 公式サイトから、またはGitHubのリポジトリ( Basic 、 Intermediate 、 Advanced )の2つの方法で実行できます。 最初の方法を使用すると、Yiiのさまざまな拡張機能をパッケージに追加できますが、何らかの理由で、中間テンプレートのアセンブリは、不正な初期化スクリプトを含む古いバージョンのYiinitializrに基づいています( 警告!これは中間テンプレートにのみ適用されます)。 同時に、リポジトリのメインブランチからのソースは、インストール中にエラーが発生するComposer構成ファイルの余分な依存性という別の不快な驚きを提供します。 しかし、絶望しないでください、一緒に私たちは間違いなくこれらの問題を解決することができるでしょう。
したがって、選択する方法に応じて、適切なスポイラーを開きます。
公式サイトからアーカイブをダウンロードしました
今、少し先を走らなければなりません。 ただし、物語のスレッドを失わないようにするために、初期化スクリプトのみを修正し、すべての説明は後で行います。
アーカイブを解凍し、2つのファイルの内容を変更します。 目次
へ:
コンテンツ
へ:
アーカイブを解凍し、2つのファイルの内容を変更します。 目次
./frontend/www/index.php
へ:
require('./../../common/lib/vendor/autoload.php'); Yiinitializr\Helpers\Initializer::create('./../', 'frontend', array( __DIR__ . '/../../common/config/main.php', __DIR__ . '/../../common/config/env.php', __DIR__ . '/../../common/config/local.php' ))->run();
コンテンツ
./backend/www/index.php
へ:
require('./../../common/lib/vendor/autoload.php'); Yiinitializr\Helpers\Initializer::create('./../', 'backend', array( __DIR__ . '/../../common/config/main.php', __DIR__ . '/../../common/config/env.php', __DIR__ . '/../../common/config/local.php' ))->run();
GitHubのサービスを使用しました
初期化スクリプトを使用すると、すべては問題ありませんが、Composer依存関係を取り除く必要があります。 これを行うには、。
ファイルを開き、
を削除します。
ブロックから。
./composer.json
ファイルを開き、
./composer.json
を削除します。
"2amigos/yiistrap": "dev-master",
require
ブロックから。
新しくダウンロードしたYiinitializr Intermediateテンプレートの現在のバージョンがコンピューターにあるので、その構造を調査することを提案します(他の2つのバージョンでも、物事は似ているため、理解するのに困難はありません)。 アプリケーションは4つの部分に分かれています(
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController .
:
. . — . backend- frontend- ./_part_>/www/
. Yiinitializr, , Composer ./comon/lib/
. vendor
. , , ./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, ( ), , -, ().
() — , .
() — , . -: dev
( ) prod
( ).
( ) .//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. , require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows , repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit %PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . , dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
, Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate, {{migration}}
. .
, « » (4 ). Yiinitializr Composer, . , env.lock
( ./common/lib/Yiinitializr/config/env.lock
). , .
! .//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46 ./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY , loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
; yii.traceLevel
; yii.handleErrors
; php.defaultCharset
; php.timezone
.
, . , , , / debug-. e ./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer --no-dev
, prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, , yiinitializr-simple
.
, .
, .//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , . .//www/ DocumentRoot
. , ISP Manager , /www/yiinitializr/frontend/www
WWW .
! , , . .//www/.htaccess. , , , .
Access forbidden backend?
./backend/
- .htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer . ./common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ . <vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController .
:
. . — . backend- frontend- ./_part_>/www/
. Yiinitializr, , Composer ./comon/lib/
. vendor
. , , ./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, ( ), , -, ().
() — , .
() — , . -: dev
( ) prod
( ).
( ) .//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. , require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows , repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit %PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . , dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
, Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate, {{migration}}
. .
, « » (4 ). Yiinitializr Composer, . , env.lock
( ./common/lib/Yiinitializr/config/env.lock
). , .
! .//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46 ./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY , loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
; yii.traceLevel
; yii.handleErrors
; php.defaultCharset
; php.timezone
.
, . , , , / debug-. e ./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer --no-dev
, prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, , yiinitializr-simple
.
, .
, .//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , . .//www/ DocumentRoot
. , ISP Manager , /www/yiinitializr/frontend/www
WWW .
! , , . .//www/.htaccess. , , , .
Access forbidden backend?
./backend/
- .htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer . ./common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ . <vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
-
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController .
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( ).//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
-
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController .
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( ).//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
-
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( ).//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend- ./_part_>/www/
. Yiinitializr, , Composer ./comon/lib/
. vendor
. , , ./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, ( ), , -, ().
() — , .
() — , . -: dev
( ) prod
( ).
( ) .//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. , require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows , repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit %PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . , dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
, Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate, {{migration}}
. .
, « » (4 ). Yiinitializr Composer, . , env.lock
( ./common/lib/Yiinitializr/config/env.lock
). , .
! .//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46 ./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY , loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
; yii.traceLevel
; yii.handleErrors
; php.defaultCharset
; php.timezone
.
, . , , , / debug-. e ./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer --no-dev
, prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, , yiinitializr-simple
.
, .
, .//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , . .//www/ DocumentRoot
. , ISP Manager , /www/yiinitializr/frontend/www
WWW .
! , , . .//www/.htaccess. , , , .
Access forbidden backend?
./backend/
- .htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer . ./common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ . <vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
-
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( ).//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
-
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( ).//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
-
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( ).//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
-
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( ).//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend- ./_part_>/www/
. Yiinitializr, , Composer ./comon/lib/
. vendor
. , , ./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, ( ), , -, ().
() — , .
() — , . -: dev
( ) prod
( ).
( ) .//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. , require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows , repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit %PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . , dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
, Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate, {{migration}}
. .
, « » (4 ). Yiinitializr Composer, . , env.lock
( ./common/lib/Yiinitializr/config/env.lock
). , .
! .//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46 ./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY , loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
; yii.traceLevel
; yii.handleErrors
; php.defaultCharset
; php.timezone
.
, . , , , / debug-. e ./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer --no-dev
, prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, , yiinitializr-simple
.
, .
, .//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , . .//www/ DocumentRoot
. , ISP Manager , /www/yiinitializr/frontend/www
WWW .
! , , . .//www/.htaccess. , , , .
Access forbidden backend?
./backend/
- .htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer . ./common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ . <vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend- ./_part_>/www/
. Yiinitializr, , Composer ./comon/lib/
. vendor
. , , ./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, ( ), , -, ().
() — , .
() — , . -: dev
( ) prod
( ).
( ) .//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. , require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows , repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit %PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . , dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
, Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate, {{migration}}
. .
, « » (4 ). Yiinitializr Composer, . , env.lock
( ./common/lib/Yiinitializr/config/env.lock
). , .
! .//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46 ./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY , loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
; yii.traceLevel
; yii.handleErrors
; php.defaultCharset
; php.timezone
.
, . , , , / debug-. e ./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer --no-dev
, prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, , yiinitializr-simple
.
, .
, .//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , . .//www/ DocumentRoot
. , ISP Manager , /www/yiinitializr/frontend/www
WWW .
! , , . .//www/.htaccess. , , , .
Access forbidden backend?
./backend/
- .htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer . ./common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ . <vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-
./_part_>/www/
. Yiinitializr, , Composer
./comon/lib/
.
vendor
. , ,
./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (
), , -, ().
() — , .
() — , . -: dev
( ) prod
( ).
( ) .//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. , require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows , repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit %PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . , dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
, Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate, {{migration}}
. .
, « » (4 ). Yiinitializr Composer, . , env.lock
( ./common/lib/Yiinitializr/config/env.lock
). , .
! .//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46 ./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY , loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
; yii.traceLevel
; yii.handleErrors
; php.defaultCharset
; php.timezone
.
, . , , , / debug-. e ./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer --no-dev
, prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, , yiinitializr-simple
.
, .
, .//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , . .//www/ DocumentRoot
. , ISP Manager , /www/yiinitializr/frontend/www
WWW .
! , , . .//www/.htaccess. , , , .
Access forbidden backend?
./backend/
- .htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer . ./common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ . <vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend- ./_part_>/www/
. Yiinitializr, , Composer ./comon/lib/
. vendor
. , , ./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, ( ), , -, ().
() — , .
() — , . -: dev
( ) prod
( ).
( ) .//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. , require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows , repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit %PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . , dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
, Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate, {{migration}}
. .
, « » (4 ). Yiinitializr Composer, . , env.lock
( ./common/lib/Yiinitializr/config/env.lock
). , .
! .//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46 ./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY , loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
; yii.traceLevel
; yii.handleErrors
; php.defaultCharset
; php.timezone
.
, . , , , / debug-. e ./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer --no-dev
, prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, , yiinitializr-simple
.
, .
, .//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , . .//www/ DocumentRoot
. , ISP Manager , /www/yiinitializr/frontend/www
WWW .
! , , . .//www/.htaccess. , , , .
Access forbidden backend?
./backend/
- .htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer . ./common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ . <vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend- ./_part_>/www/
. Yiinitializr, , Composer ./comon/lib/
. vendor
. , , ./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, ( ), , -, ().
() — , .
() — , . -: dev
( ) prod
( ).
( ) .//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. , require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows , repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit %PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . , dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
, Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate, {{migration}}
. .
, « » (4 ). Yiinitializr Composer, . , env.lock
( ./common/lib/Yiinitializr/config/env.lock
). , .
! .//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46 ./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY , loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
; yii.traceLevel
; yii.handleErrors
; php.defaultCharset
; php.timezone
.
, . , , , / debug-. e ./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer --no-dev
, prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, , yiinitializr-simple
.
, .
, .//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , . .//www/ DocumentRoot
. , ISP Manager , /www/yiinitializr/frontend/www
WWW .
! , , . .//www/.htaccess. , , , .
Access forbidden backend?
./backend/
- .htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer . ./common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ . <vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend- ./_part_>/www/
. Yiinitializr, , Composer ./comon/lib/
. vendor
. , , ./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, ( ), , -, ().
() — , .
() — , . -: dev
( ) prod
( ).
( ) .//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. , require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows , repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit %PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . , dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
, Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate, {{migration}}
. .
, « » (4 ). Yiinitializr Composer, . , env.lock
( ./common/lib/Yiinitializr/config/env.lock
). , .
! .//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46 ./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY , loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
; yii.traceLevel
; yii.handleErrors
; php.defaultCharset
; php.timezone
.
, . , , , / debug-. e ./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer --no-dev
, prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, , yiinitializr-simple
.
, .
, .//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , . .//www/ DocumentRoot
. , ISP Manager , /www/yiinitializr/frontend/www
WWW .
! , , . .//www/.htaccess. , , , .
Access forbidden backend?
./backend/
- .htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer . ./common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ . <vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend- ./_part_>/www/
. Yiinitializr, , Composer ./comon/lib/
. vendor
. , , ./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, ( ), , -, ().
() — , .
() — , . -: dev
( ) prod
( ).
( ) .//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. , require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows , repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit %PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . , dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
, Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate, {{migration}}
. .
, « » (4 ). Yiinitializr Composer, . , env.lock
( ./common/lib/Yiinitializr/config/env.lock
). , .
! .//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46 ./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY , loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
; yii.traceLevel
; yii.handleErrors
; php.defaultCharset
; php.timezone
.
, . , , , / debug-. e ./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer --no-dev
, prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, , yiinitializr-simple
.
, .
, .//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , . .//www/ DocumentRoot
. , ISP Manager , /www/yiinitializr/frontend/www
WWW .
! , , . .//www/.htaccess. , , , .
Access forbidden backend?
./backend/
- .htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer . ./common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ . <vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend- ./_part_>/www/
. Yiinitializr, , Composer ./comon/lib/
. vendor
. , , ./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, ( ), , -, ().
() — , .
() — , . -: dev
( ) prod
( ).
( ) .//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. , require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows , repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit %PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . , dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
, Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate, {{migration}}
. .
, « » (4 ). Yiinitializr Composer, . , env.lock
( ./common/lib/Yiinitializr/config/env.lock
). , .
! .//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46 ./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY , loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
; yii.traceLevel
; yii.handleErrors
; php.defaultCharset
; php.timezone
.
, . , , , / debug-. e ./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer --no-dev
, prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, , yiinitializr-simple
.
, .
, .//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , . .//www/ DocumentRoot
. , ISP Manager , /www/yiinitializr/frontend/www
WWW .
! , , . .//www/.htaccess. , , , .
Access forbidden backend?
./backend/
- .htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer . ./common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ . <vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend- ./_part_>/www/
. Yiinitializr, , Composer ./comon/lib/
. vendor
. , , ./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, ( ), , -, ().
() — , .
() — , . -: dev
( ) prod
( ).
( ) .//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. , require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows , repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit %PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . , dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
, Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate, {{migration}}
. .
, « » (4 ). Yiinitializr Composer, . , env.lock
( ./common/lib/Yiinitializr/config/env.lock
). , .
! .//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/ , , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46 ./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY , loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
; yii.traceLevel
; yii.handleErrors
; php.defaultCharset
; php.timezone
.
, . , , , / debug-. e ./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer --no-dev
, prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, , yiinitializr-simple
.
, .
, .//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , . .//www/ DocumentRoot
. , ISP Manager , /www/yiinitializr/frontend/www
WWW .
! , , . .//www/.htaccess. , , , .
Access forbidden backend?
./backend/
- .htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer . ./common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ . <vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend- ./_part_>/www/
. Yiinitializr, , Composer ./comon/lib/
. vendor
. , , ./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, ( ), , -, ().
() — , .
() — , . -: dev
( ) prod
( ).
( ) .//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. , require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows , repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit %PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . , dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
, Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate, {{migration}}
. .
, « » (4 ). Yiinitializr Composer, . , env.lock
( ./common/lib/Yiinitializr/config/env.lock
). , .
! .//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/ , , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46 ./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY , loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
; yii.traceLevel
; yii.handleErrors
; php.defaultCharset
; php.timezone
.
, . , , , / debug-. e ./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer --no-dev
, prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, , yiinitializr-simple
.
, .
, .//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , . .//www/ DocumentRoot
. , ISP Manager , /www/yiinitializr/frontend/www
WWW .
! , , . .//www/.htaccess. , , , .
Access forbidden backend?
./backend/
- .htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer . ./common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ . <vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend- ./_part_>/www/
. Yiinitializr, , Composer ./comon/lib/
. vendor
. , , ./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, ( ), , -, ().
() — , .
() — , . -: dev
( ) prod
( ).
( ) .//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. , require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows , repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit %PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . , dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
, Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate, {{migration}}
. .
, « » (4 ). Yiinitializr Composer, . , env.lock
( ./common/lib/Yiinitializr/config/env.lock
). , .
! .//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/ , , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46 ./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY , loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
; yii.traceLevel
; yii.handleErrors
; php.defaultCharset
; php.timezone
.
, . , , , / debug-. e ./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer --no-dev
, prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, , yiinitializr-simple
.
, .
, .//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , . .//www/ DocumentRoot
. , ISP Manager , /www/yiinitializr/frontend/www
WWW .
! , , . .//www/.htaccess. , , , .
Access forbidden backend?
./backend/
- .htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer . ./common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ . <vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
-
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( ).//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/ , , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
-
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( ).//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/ , , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
-
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( ).//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/ , , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend- ./_part_>/www/
. Yiinitializr, , Composer ./comon/lib/
. vendor
. , , ./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, ( ), , -, ().
() — , .
() — , . -: dev
( ) prod
( ).
( ) .//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. , require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows , repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit %PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . , dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
, Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate, {{migration}}
. .
, « » (4 ). Yiinitializr Composer, . , env.lock
( ./common/lib/Yiinitializr/config/env.lock
). , .
! .//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/ , , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46 ./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY , loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
; yii.traceLevel
; yii.handleErrors
; php.defaultCharset
; php.timezone
.
, . , , , / debug-. e ./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer --no-dev
, prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, , yiinitializr-simple
.
, .
, .//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , . .//www/ DocumentRoot
. , ISP Manager , /www/yiinitializr/frontend/www
WWW .
! , , . .//www/.htaccess. , , , .
Access forbidden backend?
./backend/
- .htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer . ./common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ . <vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( ).//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/ , , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend- ./_part_>/www/
. Yiinitializr, , Composer ./comon/lib/
. vendor
. , , ./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, ( ), , -, ().
() — , .
() — , . -: dev
( ) prod
( ).
( ) .//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. , require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows , repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit %PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . , dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
, Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate, {{migration}}
. .
, « » (4 ). Yiinitializr Composer, . , env.lock
( ./common/lib/Yiinitializr/config/env.lock
). , .
! .//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/ , , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46 ./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY , loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
; yii.traceLevel
; yii.handleErrors
; php.defaultCharset
; php.timezone
.
, . , , , / debug-. e ./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer --no-dev
, prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, , yiinitializr-simple
.
, .
, .//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , . .//www/ DocumentRoot
. , ISP Manager , /www/yiinitializr/frontend/www
WWW .
! , , . .//www/.htaccess. , , , .
Access forbidden backend?
./backend/
- .htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer . ./common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ . <vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend- ./_part_>/www/
. Yiinitializr, , Composer ./comon/lib/
. vendor
. , , ./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, ( ), , -, ().
() — , .
() — , . -: dev
( ) prod
( ).
( ) .//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. , require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows , repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit %PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . , dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
, Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate, {{migration}}
. .
, « » (4 ). Yiinitializr Composer, . , env.lock
( ./common/lib/Yiinitializr/config/env.lock
). , .
! .//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46 ./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY , loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
; yii.traceLevel
; yii.handleErrors
; php.defaultCharset
; php.timezone
.
, . , , , / debug-. e ./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer --no-dev
, prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, , yiinitializr-simple
.
, .
, .//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , . .//www/ DocumentRoot
. , ISP Manager , /www/yiinitializr/frontend/www
WWW .
! , , . .//www/.htaccess. , , , .
Access forbidden backend?
./backend/
- .htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer . ./common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ . <vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend- ./_part_>/www/
. Yiinitializr, , Composer ./comon/lib/
. vendor
. , , ./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, ( ), , -, ().
() — , .
() — , . -: dev
( ) prod
( ).
( ) .//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. , require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows , repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit %PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . , dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
, Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate, {{migration}}
. .
, « » (4 ). Yiinitializr Composer, . , env.lock
( ./common/lib/Yiinitializr/config/env.lock
). , .
! .//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/ , , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46 ./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY , loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
; yii.traceLevel
; yii.handleErrors
; php.defaultCharset
; php.timezone
.
, . , , , / debug-. e ./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer --no-dev
, prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, , yiinitializr-simple
.
, .
, .//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , . .//www/ DocumentRoot
. , ISP Manager , /www/yiinitializr/frontend/www
WWW .
! , , . .//www/.htaccess. , , , .
Access forbidden backend?
./backend/
- .htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer . ./common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ . <vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend- ./_part_>/www/
. Yiinitializr, , Composer ./comon/lib/
. vendor
. , , ./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, ( ), , -, ().
() — , .
() — , . -: dev
( ) prod
( ).
( ) .//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. , require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows , repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit %PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . , dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
, Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate, {{migration}}
. .
, « » (4 ). Yiinitializr Composer, . , env.lock
( ./common/lib/Yiinitializr/config/env.lock
). , .
! .//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46 ./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY , loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
; yii.traceLevel
; yii.handleErrors
; php.defaultCharset
; php.timezone
.
, . , , , / debug-. e ./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer --no-dev
, prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, , yiinitializr-simple
.
, .
, .//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , . .//www/ DocumentRoot
. , ISP Manager , /www/yiinitializr/frontend/www
WWW .
! , , . .//www/.htaccess. , , , .
Access forbidden backend?
./backend/
- .htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer . ./common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ . <vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend- ./_part_>/www/
. Yiinitializr, , Composer ./comon/lib/
. vendor
. , , ./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, ( ), , -, ().
() — , .
() — , . -: dev
( ) prod
( ).
( ) .//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. , require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows , repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit %PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . , dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
, Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate, {{migration}}
. .
, « » (4 ). Yiinitializr Composer, . , env.lock
( ./common/lib/Yiinitializr/config/env.lock
). , .
! .//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/ , , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46 ./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY , loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
; yii.traceLevel
; yii.handleErrors
; php.defaultCharset
; php.timezone
.
, . , , , / debug-. e ./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer --no-dev
, prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, , yiinitializr-simple
.
, .
, .//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , . .//www/ DocumentRoot
. , ISP Manager , /www/yiinitializr/frontend/www
WWW .
! , , . .//www/.htaccess. , , , .
Access forbidden backend?
./backend/
- .htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer . ./common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ . <vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend- ./_part_>/www/
. Yiinitializr, , Composer ./comon/lib/
. vendor
. , , ./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, ( ), , -, ().
() — , .
() — , . -: dev
( ) prod
( ).
( ) .//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. , require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows , repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit %PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . , dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
, Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate, {{migration}}
. .
, « » (4 ). Yiinitializr Composer, . , env.lock
( ./common/lib/Yiinitializr/config/env.lock
). , .
! .//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46 ./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY , loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
; yii.traceLevel
; yii.handleErrors
; php.defaultCharset
; php.timezone
.
, . , , , / debug-. e ./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer --no-dev
, prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, , yiinitializr-simple
.
, .
, .//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , . .//www/ DocumentRoot
. , ISP Manager , /www/yiinitializr/frontend/www
WWW .
! , , . .//www/.htaccess. , , , .
Access forbidden backend?
./backend/
- .htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer . ./common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ . <vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend- ./_part_>/www/
. Yiinitializr, , Composer ./comon/lib/
. vendor
. , , ./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, ( ), , -, ().
() — , .
() — , . -: dev
( ) prod
( ).
( ) .//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. , require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows , repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit %PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . , dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
, Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate, {{migration}}
. .
, « » (4 ). Yiinitializr Composer, . , env.lock
( ./common/lib/Yiinitializr/config/env.lock
). , .
! .//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/ , , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46 ./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY , loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
; yii.traceLevel
; yii.handleErrors
; php.defaultCharset
; php.timezone
.
, . , , , / debug-. e ./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer --no-dev
, prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, , yiinitializr-simple
.
, .
, .//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , . .//www/ DocumentRoot
. , ISP Manager , /www/yiinitializr/frontend/www
WWW .
! , , . .//www/.htaccess. , , , .
Access forbidden backend?
./backend/
- .htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer . ./common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ . <vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( ).//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/ , , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend- ./_part_>/www/
. Yiinitializr, , Composer ./comon/lib/
. vendor
. , , ./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, ( ), , -, ().
() — , .
() — , . -: dev
( ) prod
( ).
( ) .//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. , require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows , repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit %PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . , dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
, Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate, {{migration}}
. .
, « » (4 ). Yiinitializr Composer, . , env.lock
( ./common/lib/Yiinitializr/config/env.lock
). , .
! .//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/ , , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46 ./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY , loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
; yii.traceLevel
; yii.handleErrors
; php.defaultCharset
; php.timezone
.
, . , , , / debug-. e ./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer --no-dev
, prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, , yiinitializr-simple
.
, .
, .//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , . .//www/ DocumentRoot
. , ISP Manager , /www/yiinitializr/frontend/www
WWW .
! , , . .//www/.htaccess. , , , .
Access forbidden backend?
./backend/
- .htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer . ./common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ . <vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend- ./_part_>/www/
. Yiinitializr, , Composer ./comon/lib/
. vendor
. , , ./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, ( ), , -, ().
() — , .
() — , . -: dev
( ) prod
( ).
( ) .//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. , require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows , repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit %PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . , dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
, Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate, {{migration}}
. .
, « » (4 ). Yiinitializr Composer, . , env.lock
( ./common/lib/Yiinitializr/config/env.lock
). , .
! .//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/ , , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46 ./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY , loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
; yii.traceLevel
; yii.handleErrors
; php.defaultCharset
; php.timezone
.
, . , , , / debug-. e ./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer --no-dev
, prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, , yiinitializr-simple
.
, .
, .//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , . .//www/ DocumentRoot
. , ISP Manager , /www/yiinitializr/frontend/www
WWW .
! , , . .//www/.htaccess. , , , .
Access forbidden backend?
./backend/
- .htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer . ./common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ . <vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend- ./_part_>/www/
. Yiinitializr, , Composer ./comon/lib/
. vendor
. , , ./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, ( ), , -, ().
() — , .
() — , . -: dev
( ) prod
( ).
( ) .//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. , require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows , repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit %PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . , dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
, Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate, {{migration}}
. .
, « » (4 ). Yiinitializr Composer, . , env.lock
( ./common/lib/Yiinitializr/config/env.lock
). , .
! .//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/ , , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46 ./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY , loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
; yii.traceLevel
; yii.handleErrors
; php.defaultCharset
; php.timezone
.
, . , , , / debug-. e ./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer --no-dev
, prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, , yiinitializr-simple
.
, .
, .//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , . .//www/ DocumentRoot
. , ISP Manager , /www/yiinitializr/frontend/www
WWW .
! , , . .//www/.htaccess. , , , .
Access forbidden backend?
./backend/
- .htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer . ./common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ . <vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend- ./_part_>/www/
. Yiinitializr, , Composer ./comon/lib/
. vendor
. , , ./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, ( ), , -, ().
() — , .
() — , . -: dev
( ) prod
( ).
( ) .//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. , require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows , repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit %PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . , dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
, Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate, {{migration}}
. .
, « » (4 ). Yiinitializr Composer, . , env.lock
( ./common/lib/Yiinitializr/config/env.lock
). , .
! .//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/ , , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46 ./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY , loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
; yii.traceLevel
; yii.handleErrors
; php.defaultCharset
; php.timezone
.
, . , , , / debug-. e ./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer --no-dev
, prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, , yiinitializr-simple
.
, .
, .//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , . .//www/ DocumentRoot
. , ISP Manager , /www/yiinitializr/frontend/www
WWW .
! , , . .//www/.htaccess. , , , .
Access forbidden backend?
./backend/
- .htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer . ./common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ . <vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend- ./_part_>/www/
. Yiinitializr, , Composer ./comon/lib/
. vendor
. , , ./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, ( ), , -, ().
() — , .
() — , . -: dev
( ) prod
( ).
( ) .//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. , require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows , repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit %PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . , dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
, Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate, {{migration}}
. .
, « » (4 ). Yiinitializr Composer, . , env.lock
( ./common/lib/Yiinitializr/config/env.lock
). , .
! .//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/ , , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46 ./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY , loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
; yii.traceLevel
; yii.handleErrors
; php.defaultCharset
; php.timezone
.
, . , , , / debug-. e ./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer --no-dev
, prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, , yiinitializr-simple
.
, .
, .//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , . .//www/ DocumentRoot
. , ISP Manager , /www/yiinitializr/frontend/www
WWW .
! , , . .//www/.htaccess. , , , .
Access forbidden backend?
./backend/
- .htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer . ./common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ . <vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( ).//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/ , , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend- ./_part_>/www/
. Yiinitializr, , Composer ./comon/lib/
. vendor
. , , ./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, ( ), , -, ().
() — , .
() — , . -: dev
( ) prod
( ).
( ) .//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. , require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows , repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit %PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . , dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
, Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate, {{migration}}
. .
, « » (4 ). Yiinitializr Composer, . , env.lock
( ./common/lib/Yiinitializr/config/env.lock
). , .
! .//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/ , , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46 ./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY , loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
; yii.traceLevel
; yii.handleErrors
; php.defaultCharset
; php.timezone
.
, . , , , / debug-. e ./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer --no-dev
, prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, , yiinitializr-simple
.
, .
, .//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , . .//www/ DocumentRoot
. , ISP Manager , /www/yiinitializr/frontend/www
WWW .
! , , . .//www/.htaccess. , , , .
Access forbidden backend?
./backend/
- .htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer . ./common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ . <vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend- ./_part_>/www/
. Yiinitializr, , Composer ./comon/lib/
. vendor
. , , ./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, ( ), , -, ().
() — , .
() — , . -: dev
( ) prod
( ).
( ) .//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. , require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows , repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit %PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . , dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
, Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate, {{migration}}
. .
, « » (4 ). Yiinitializr Composer, . , env.lock
( ./common/lib/Yiinitializr/config/env.lock
). , .
! .//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/ , , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46 ./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY , loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
; yii.traceLevel
; yii.handleErrors
; php.defaultCharset
; php.timezone
.
, . , , , / debug-. e ./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer --no-dev
, prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, , yiinitializr-simple
.
, .
, .//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , . .//www/ DocumentRoot
. , ISP Manager , /www/yiinitializr/frontend/www
WWW .
! , , . .//www/.htaccess. , , , .
Access forbidden backend?
./backend/
- .htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer . ./common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ . <vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend- ./_part_>/www/
. Yiinitializr, , Composer ./comon/lib/
. vendor
. , , ./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, ( ), , -, ().
() — , .
() — , . -: dev
( ) prod
( ).
( ) .//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. , require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows , repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit %PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . , dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
, Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate, {{migration}}
. .
, « » (4 ). Yiinitializr Composer, . , env.lock
( ./common/lib/Yiinitializr/config/env.lock
). , .
! .//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/ , , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46 ./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY , loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
; yii.traceLevel
; yii.handleErrors
; php.defaultCharset
; php.timezone
.
, . , , , / debug-. e ./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer --no-dev
, prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, , yiinitializr-simple
.
, .
, .//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , . .//www/ DocumentRoot
. , ISP Manager , /www/yiinitializr/frontend/www
WWW .
! , , . .//www/.htaccess. , , , .
Access forbidden backend?
./backend/
- .htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer . ./common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ . <vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend- ./_part_>/www/
. Yiinitializr, , Composer ./comon/lib/
. vendor
. , , ./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, ( ), , -, ().
() — , .
() — , . -: dev
( ) prod
( ).
( ) .//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. , require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows , repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit %PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . , dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
, Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate, {{migration}}
. .
, « » (4 ). Yiinitializr Composer, . , env.lock
( ./common/lib/Yiinitializr/config/env.lock
). , .
! .//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/ , , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46 ./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY , loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
; yii.traceLevel
; yii.handleErrors
; php.defaultCharset
; php.timezone
.
, . , , , / debug-. e ./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer --no-dev
, prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, , yiinitializr-simple
.
, .
, .//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , . .//www/ DocumentRoot
. , ISP Manager , /www/yiinitializr/frontend/www
WWW .
! , , . .//www/.htaccess. , , , .
Access forbidden backend?
./backend/
- .htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer . ./common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ . <vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend- ./_part_>/www/
. Yiinitializr, , Composer ./comon/lib/
. vendor
. , , ./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, ( ), , -, ().
() — , .
() — , . -: dev
( ) prod
( ).
( ) .//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. , require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows , repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit %PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . , dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
, Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate, {{migration}}
. .
, « » (4 ). Yiinitializr Composer, . , env.lock
( ./common/lib/Yiinitializr/config/env.lock
). , .
! .//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/ , , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46 ./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY , loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
; yii.traceLevel
; yii.handleErrors
; php.defaultCharset
; php.timezone
.
, . , , , / debug-. e ./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer --no-dev
, prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, , yiinitializr-simple
.
, .
, .//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , . .//www/ DocumentRoot
. , ISP Manager , /www/yiinitializr/frontend/www
WWW .
! , , . .//www/.htaccess. , , , .
Access forbidden backend?
./backend/
- .htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer . ./common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ . <vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
-
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( ).//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/ , , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
-
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( ).//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/ , , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
-
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( ).//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/ , , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
-
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( ).//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/ , , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
-
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( ).//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/ , , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
-
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( ).//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/ , , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend- ./_part_>/www/
. Yiinitializr, , Composer ./comon/lib/
. vendor
. , , ./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, ( ), , -, ().
() — , .
() — , . -: dev
( ) prod
( ).
( ) .//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. , require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows , repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit %PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . , dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
, Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate, {{migration}}
. .
, « » (4 ). Yiinitializr Composer, . , env.lock
( ./common/lib/Yiinitializr/config/env.lock
). , .
! .//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/ , , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46 ./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY , loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
; yii.traceLevel
; yii.handleErrors
; php.defaultCharset
; php.timezone
.
, . , , , / debug-. e ./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer --no-dev
, prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, , yiinitializr-simple
.
, .
, .//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , . .//www/ DocumentRoot
. , ISP Manager , /www/yiinitializr/frontend/www
WWW .
! , , . .//www/.htaccess. , , , .
Access forbidden backend?
./backend/
- .htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer . ./common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ . <vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( ).//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/ , , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( ).//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/ , , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (
), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (
), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (
), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (
), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (
), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (
), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (
), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (
), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,
.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , .
.//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !
):
backend frontend — ; console — ; common — . , , backend- frontend-, SiteController
.
:
. . — . backend- frontend-./_part_>/www/
. Yiinitializr, , Composer./comon/lib/
.vendor
. , ,./console/migrations/
.
2.
. :
./backend/config/backend.php ./backend/config/env/dev.php ./backend/config/env/prod.php ./comon/config/main.php ./comon/config/test.php ./comon/config/env/dev.php ./comon/config/end/prod.php ./console/config/console.php ./console/config/env/dev.php ./console/config/env/prod.php ./frontend/config/frontend.php ./frontend/config/env/dev.php ./frontend/config/env/prod.php
. , :
./<part>/config/<part>.php ./<part>/config/env/<environment>.php
, -, (), , -, ().
() — , .
() — , . -: dev
( )prod
( ).
( )
.//config/env.php .//config/env/.php . , , . , , . :
, — . ./comon/config/env/dev.php
. , , .
? ! .
3. Composer
Yii, :
. PHPUnit Selenium. Yii . . Yii , .
Yiinitializr Composer, .
! , , PhpUnit. , , , . .
Composer — PHP . , .
./composer.json
. ,require
:
"require":{ "yiisoft/yii":"1.1.14", "2amigos/yiiwheels":"1.0.3" },
— Yii, ( ) Yiinitializr: Yiistrap — Twitter Bootstrap Yii, Yiiwheels — Yiistrap. yii . , . , , . , . PhpUnit .
:
"require-dev":{ "phpunit/php-invoker": "1.1.0", "phpunit/dbunit": "1.3.0", "phpunit/phpunit-story": "dev-master", "phpunit/phpunit-selenium": "dev-master" },
. php-invoker PHP- ext-pcntl, [ ] Unix . Windows ,repositories
php-invoker Composer, Git:
"repositories":[ { "type":"composer", "url":"http://packages.phundament.com" }, { "type":"package", "package":{ "name":"phpunit/php-invoker", "version":"1.1.0", "source":{ "type":"git", "url":"http://github.com/sebastianbergmann/php-invoker", "reference":"master" }, "autoload":{ "classmap": [ "PHP/" ] } } } ],
! PhpUnit%PATH%
Git .
- , . Composer. , , . . phar- Yiinitializr.
. Composer :
> php composer.phar self-update
:
> php composer.phar install
! , PHP . , SSL , PHP .
:
Start Installation? [y/n]: y
, . . ,dev
Enter:
Please, enter your environment -ie. "dev | prod | stage": [dev]: dev
,Installation completed!
Composer?
env.php
. : runtime, assets. . . ( Composer ). Composer migrate,{{migration}}
. .
, « » (4 ). Yiinitializr Composer, . ,env.lock
(./common/lib/Yiinitializr/config/env.lock
). , .
!
.//config/env.php, . . - Git , «». .//config/env/.php.
Yiinitializr
Yiinitializr, .
Yiinitializr — , , . , 3 , . Initializr Twitter Bootstrap, Modernizr JQuery. Initializr-.
. Yiinitializr , . /common/extensions/components/
, , .
EWebApplication — CWebApplication. , . , , , EWebApplication, ~46./common/lib/Yiinitializr/Helpers/Initializer.php
$app = \Yii::createWebApplication($config);
$app = \Yii::createApplication('EWebApplication', $config);
EActiveRecord — CActiveRecord, , ( EController), .
EController — DRY ,loadModel
performAjaxValidation
, . , - .
! , , CRUD Gii. FAQ .
, Yiinitializr . ? , debug- , . debug-, .
params
. :
yii.debug
;yii.traceLevel
;yii.handleErrors
;php.defaultCharset
;php.timezone
.
, . , , , / debug-. e./common/config/env/dev.php
:
'params' => array( 'yii.handleErrors' => true, 'yii.debug' => true, 'yii.traceLevel' => 3, )
./common/config/env/prod.php
:
'params' => array( 'yii.handleErrors' => false, 'yii.debug' => false, 'yii.traceLevel' => 0, )
! Composer. ,./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
. PHP-, Yiinitializr.
, Git-, , :
> cd projects > git clone yiinitializr yiinitializr-prod Cloning into 'yiinitializr-prod'... done.
.gitignore
, , , . , , Composer--no-dev
,prod
:
> php composer.phar install --no-dev
, , ( ).
?
Yiinitializr , , . , , Yiinitializr .
Gii CRUD?
EActiveRecord EController, — Gii CRUD - .
— Gii , . .
./common
./common/config/env/dev.php
:
'gii' => array( ... 'generatorPaths' => array('common.gii'), ),
, Code Template Crud Generator, ,yiinitializr-simple
.
, .
,.//config/env.php, . . - Git , «». .//config/env/.php. Composer. , ./common/config/env.php
./common/lib/Yiinitializr/config/env.lock
,
> php composer.phar update
, , .
Yiinitializr ?
Yiinitializr , ..//www/ DocumentRoot
. , ISP Manager ,/www/yiinitializr/frontend/www
WWW .
! , , ..//www/.htaccess. , , , .
Access forbidden backend?
./backend/
-.htaccess
deny from all
. , - , . !
Composer?
Yi i. Yiinitializr ComposerCallback Phundament / Composer ../common/lib/Yiinitializr/config/console.php
:
'params' => array( 'composer.callbacks' => array( 'post-update' => array('yiic', 'migrate'), 'post-install' => array('yiic', 'migrate'), ) ),
`./yiic migrate`
post-install post-update.
/ .<vendor/-, :
'params' => array( 'composer.callbacks' => array( 'yiisoft/yii-install' => array('yiic', 'webapp', realpath(dirname(__FILE__))), ), ),
, : pre-install, post-install, pre-update, post-update, post-package-install, post-package-update.
?
, Yiinitializr — , . .
?
-, , PhpUnit, Composer. Yii , PhpUnit + Composer.
, . , , -, , , -, PhpUnit.
. Yiinitializr, :
require(__DIR__ . '/../../common/lib/vendor/autoload.php'); $config = Yiinitializr\Helpers\Initializer::config('frontend', array( dirname(__FILE__) . '/../../common/config/main.php', dirname(__FILE__) . '/../../common/config/env.php', dirname(__FILE__) . '/../../common/config/test.php', )); Yii::import('system.test.CTestCase'); Yii::import('system.test.CDbTestCase'); Yii::import('system.test.CWebTestCase'); Yii::createWebApplication($config);
, test.php .
. :
> cd .\frontend\tests\ > ..\..\common\lib\vendor\bin\phpunit .
! , Selenium Server .
Yii Framework — Yii. Yiinitializr — . Basic , Intermediate , Advanced Yiinitializr. Composer — PHP. Composer . Yii Composer .
PS , , , . !