yii 2 установка

June 23, 2015


https://github.com/yiisoft/yii2/blob/master/docs/guide-ru/start-installation.md
Использовать composer можно из open-server
Правой клавишей мышки по флажку (сервер должен быть запущен)Ладно, но если у вас есть composer, то установить достаточно просто.
дополнительно -> консоль


для использования под прокси нужно сначала прописать

set http_proxy=http://proxy.ru:port/
set https_proxy=http://proxy.ru:port/
где proxy.ru - название вашего прокси, port - числовое значение порта


Привожу список команд из консоли openserver


Microsoft Windows [Version 6.1.7601]

(c) Корпорация Майкрософт (Microsoft Corp.), 2009. Все права защищены.

f:openserver>cd F:OpenServerdomainslocalhost

F:OpenServerdomainslocalhost>composer init

Warning: This development build of composer is over 30 days old. It is recommend

ed to update it by running "f:openservermodulesphpPHP-5.4composer.phar self

-update" to get the latest version.

  Welcome to the Composer config generator

This command will guide you through creating your composer.json config.

Package name (/) [Des/localhost]:

Description []:

Author:

 Invalid author string.  Must be in the format: John Smith

Author: des des

Minimum Stability []:

License []:

Define your dependencies.

Would you like to define your dependencies (require) interactively [yes]? no

Would you like to define your dev dependencies (require-dev) interactively [yes]

? no

{

    "name": "Des/localhost",

    "authors": [

        {

            "name": "des des",

            "email": "d@m.ru"

        }

    ],

    "require": {}

}

Do you confirm generation [yes]?

F:OpenServerdomainslocalhost>cd composer

F:OpenServerdomainslocalhostcomposer>composer instal

Warning: This development build of composer is over 30 days old. It is recommend

ed to update it by running "f:openservermodulesphpPHP-5.4composer.phar self

-update" to get the latest version.

Loading composer repositories with package information

Installing dependencies (including require-dev)

Nothing to install or update

Generating autoload files

F:OpenServerdomainslocalhostcomposer>composer global require "fxp/composer-a

sset-plugin:~1.0.0"

Warning: This development build of composer is over 30 days old. It is recommend

ed to update it by running "f:openservermodulesphpPHP-5.4composer.phar self

-update" to get the latest version.

Changed current directory to C:/Users/Des/AppData/Roaming/Composer

Warning: This development build of composer is over 30 days old. It is recommend

ed to update it by running "f:openservermodulesphpPHP-5.4composer.phar self

-update" to get the latest version.

./composer.json has been created

Loading composer repositories with package information

Updating dependencies (including require-dev)

  - Installing fxp/composer-asset-plugin (v1.0.2)

    Downloading: 100%

Writing lock file

Generating autoload files

F:OpenServerdomainslocalhostcomposer>composer create-project --prefer-dist y

iisoft/yii2-app-basic basic

Warning: This development build of composer is over 30 days old. It is recommend

ed to update it by running "f:openservermodulesphpPHP-5.4composer.phar self

-update" to get the latest version.

Installing yiisoft/yii2-app-basic (2.0.4)

  - Installing yiisoft/yii2-app-basic (2.0.4)

    Downloading: 100%

Created project in basic

Loading composer repositories with package information

Installing dependencies (including require-dev)

Reading bower.json of bower-asset/jquery.inputmask (3.1.56)

Could not fetch https://api.github.com/repos/RobinHerbots/jquery.inputmask/conte

nts/bower.json?ref=4551607fef63fd4bcd675479a8c347b668b915eb, enter your GitHub c

redentials to go over the API rate limit

The credentials will be swapped for an OAuth token stored in C:/Users/Des/AppDat

a/Roaming/Composer/auth.json, your password will not be stored

To revoke access to this token you can visit https://github.com/settings/applica

tions

Username: des1roer

Password:

Token successfully created

Could not fetch https://api.github.com/authorizations, enter your GitHub credent

ials to go over the API rate limit

The credentials will be swapped for an OAuth token stored in C:/Users/Des/AppDat

a/Roaming/Composer/auth.json, your password will not be stored

To revoke access to this token you can visit https://github.com/settings/applica

tions

Username: des1roer

Password:

An existing OAuth token for Composer is present and will be reused

  - Installing yiisoft/yii2-composer (2.0.3)

    Downloading: 100%

  - Installing ezyang/htmlpurifier (v4.6.0)

    Downloading: 100%

  - Installing cebe/markdown (1.1.0)

    Downloading: 100%

  - Installing bower-asset/jquery (2.1.4)

    Downloading: 100%

  - Installing bower-asset/jquery.inputmask (3.1.63)

    Downloading: 100%

  - Installing bower-asset/punycode (v1.3.2)

    Downloading: 100%

  - Installing bower-asset/yii2-pjax (v2.0.4)

    Downloading: 100%

  - Installing yiisoft/yii2 (2.0.4)

    Downloading: 100%

  - Installing swiftmailer/swiftmailer (v5.4.1)

    Downloading: 100%

  - Installing yiisoft/yii2-swiftmailer (2.0.4)

    Downloading: 100%

  - Installing yiisoft/yii2-codeception (2.0.4)

    Downloading: 100%

  - Installing bower-asset/bootstrap (v3.3.5)

    Downloading: 100%

  - Installing yiisoft/yii2-bootstrap (2.0.4)

    Downloading: 100%

  - Installing yiisoft/yii2-debug (2.0.4)

    Downloading: 100%

  - Installing bower-asset/typeahead.js (v0.10.5)

    Downloading: 100%

  - Installing phpspec/php-diff (v1.0.2)

    Downloading: 100%

  - Installing yiisoft/yii2-gii (2.0.4)

    Downloading: 100%

  - Installing fzaninotto/faker (v1.5.0)

    Downloading: 100%

  - Installing yiisoft/yii2-faker (2.0.3)

    Downloading: 100%

fzaninotto/faker suggests installing ext-intl (*)

Writing lock file

Generating autoload files

chmod('runtime', 0777)...done.

chmod('web/assets', 0777)...done.

chmod('yii', 0755)...done.

F:OpenServerdomainslocalhostcomposer>composer create-project --prefer-dist y

Warning: This development build of composer is over 30 days old. It is recommended to update it by running "f:openservermodul

  [InvalidArgumentException]

  Could not find package y with stability stable.

create-project [-s|--stability="..."] [--prefer-source] [--prefer-dist] [--repository-url="..."] [--dev] [--no-dev] [--no-plugirsion]

F:OpenServerdomainslocalhostcomposer>composer create-project --prefer-dist yiisoft/yii2-app-advanced  advanced

Warning: This development build of composer is over 30 days old. It is recommended to update it by running "f:openservermodulesphpPHP-5.4composer.phar self-update" to get the latest version.

Installing yiisoft/yii2-app-advanced (2.0.4)

  - Installing yiisoft/yii2-app-advanced (2.0.4)

    Downloading: 100%

Created project in advanced

Loading composer repositories with package information

Installing dependencies (including require-dev)

  - Installing yiisoft/yii2-composer (2.0.3)

    Loading from cache

  - Installing ezyang/htmlpurifier (v4.6.0)

    Loading from cache

  - Installing cebe/markdown (1.1.0)

    Loading from cache

  - Installing bower-asset/jquery (2.1.4)

    Loading from cache

  - Installing bower-asset/jquery.inputmask (3.1.63)

    Loading from cache

  - Installing bower-asset/punycode (v1.3.2)

    Loading from cache

  - Installing bower-asset/yii2-pjax (v2.0.4)

    Loading from cache

  - Installing yiisoft/yii2 (2.0.4)

    Loading from cache

  - Installing swiftmailer/swiftmailer (v5.4.1)

    Loading from cache

  - Installing yiisoft/yii2-swiftmailer (2.0.4)

    Loading from cache

  - Installing yiisoft/yii2-codeception (2.0.4)

    Loading from cache

  - Installing bower-asset/bootstrap (v3.3.5)

    Loading from cache

  - Installing yiisoft/yii2-bootstrap (2.0.4)

    Loading from cache

  - Installing yiisoft/yii2-debug (2.0.4)

    Loading from cache

  - Installing bower-asset/typeahead.js (v0.10.5)

    Loading from cache

  - Installing phpspec/php-diff (v1.0.2)

    Loading from cache

  - Installing yiisoft/yii2-gii (2.0.4)

    Loading from cache

  - Installing fzaninotto/faker (v1.5.0)

    Loading from cache

  - Installing yiisoft/yii2-faker (2.0.3)

    Loading from cache

fzaninotto/faker suggests installing ext-intl (*)

Writing lock file

Generating autoload files

F:OpenServerdomainslocalhostcomposer>cd F:OpenServerdomainslocalhostcomposeradvanced

F:OpenServerdomainslocalhostcomposeradvanced>php init

Yii Application Initialization Tool v1.0

Which environment do you want the application to be initialized in?

  [0] Development

  [1] Production

  Your choice [0-1, or "q" to quit] 0

  Initialize the application under 'Development' environment? [yes|no] yes

  Start initialization ...

   generate backend/config/main-local.php

   generate backend/config/params-local.php

   generate backend/web/index-test.php

   generate backend/web/index.php

   generate common/config/main-local.php

   generate common/config/params-local.php

   generate console/config/main-local.php

   generate console/config/params-local.php

   generate frontend/config/main-local.php

   generate frontend/config/params-local.php

   generate frontend/web/index-test.php

   generate frontend/web/index.php

   generate yii

   generate cookie validation key in backend/config/main-local.php

   generate cookie validation key in frontend/config/main-local.php

      chmod 0777 backend/runtime

      chmod 0777 backend/web/assets

      chmod 0777 frontend/runtime

      chmod 0777 frontend/web/assets

      chmod 0755 yii

      chmod 0755 tests/codeception/bin/yii

  ... initialization completed.

F:OpenServerdomainslocalhostcomposeradvanced>composer self-update

Updating to version 74e7c5fe22dc456336a2b20c7b12a9a83fc4af09.

    Downloading: 100%

Use composer self-update --rollback to return to version 37ec0bde9dd6826591308e7a1ad55cb5e38ef117

F:OpenServerdomainslocalhostcomposeradvanced>



Видите - все достаточно просто как и описано здесь (при переходе Ctrl+F и ищите  Composer)

Сначала создаем json для composer

 
D:webmasterOpenServerdomainscomposer>composer init                        
Warning: This development build of composer is over 30 days old. It is recommen
ed to update it by running "d:webmasteropenservermodulesphpPHP-5.4compose
.phar self-update" to get the latest version.                                 
                                                                              
                                                                              
  Welcome to the Composer config generator                                    
                                                                              
                                                                              
                                                                              
This command will guide you through creating your composer.json config.       
                                                                              
Package name (/) [zuev_np/composer]: des/des                    
Description []:                                                               
Author:                                                                       
 Invalid author string.  Must be in the format: John Smith  
Author: des des                                                       
Minimum Stability []:                                                         
License []:                                                                   
                                                                              
Define your dependencies.                                                     
                                                                              
Would you like to define your dependencies (require) interactively [yes]? no  
Would you like to define your dev dependencies (require-dev) interactively [yes
? no                                                                          
                                                                              
{                                                                             
    "name": "des/des",                                                        
    "authors": [                                                              
        {                                                                     
            "name": "des des",                                                
            "email": "d@m.ru"                                                 
        }                                                                     
    ],                                                                        
    "require": {}                                                             
}                                                                             
                                                                              
Do you confirm generation [yes]?                                              
                                                                              
D:webmasterOpenServerdomainscomposer>                                     

и получаем в D:webmasterOpenServerdomainscomposercomposer.json


{
"name": "des/des",
"authors": [
{
"name": "des des",
"email": "d@m.ru"
}
],
"require": {}
}

Затем команды установки
для basic

composer create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic basic


для advanced

composer create-project --prefer-dist yiisoft/yii2-app-advanced  advanced

advanced правда еще и доустановить надо командой

F:OpenServerdomainslocalhostcomposeradvanced>php init


F:OpenServerdomainslocalhostcomposer>cd F:OpenServerdomainslocalhostcomposeradvanced

F:OpenServerdomainslocalhostcomposeradvanced>php init
Yii Application Initialization Tool v1.0

Which environment do you want the application to be initialized in?

[0] Development
[1] Production

Your choice [0-1, or "q" to quit] 0

Initialize the application under 'Development' environment? [yes|no] yes

Start initialization ...

generate backend/config/main-local.php
generate backend/config/params-local.php
generate backend/web/index-test.php
generate backend/web/index.php
generate common/config/main-local.php
generate common/config/params-local.php
generate console/config/main-local.php
generate console/config/params-local.php
generate frontend/config/main-local.php
generate frontend/config/params-local.php
generate frontend/web/index-test.php
generate frontend/web/index.php
generate yii
generate cookie validation key in backend/config/main-local.php
generate cookie validation key in frontend/config/main-local.php
chmod 0777 backend/runtime
chmod 0777 backend/web/assets
chmod 0777 frontend/runtime
chmod 0777 frontend/web/assets
chmod 0755 yii
chmod 0755 tests/codeception/bin/yii

... initialization completed.

F:OpenServerdomainslocalhostcomposeradvanced>



и получим

http://localhost/composer/basic/web/index.php                               basic

http://localhost/composer/advanced/frontend/web/index.php          advanced

внизу ссылка с тем что получилось

загрузка

качаете и запускаете



Source: des1roer.blogspot.com

Комментарии

comments powered by Disqus