How to install yii2.0 basic and advanced application using composer and archived files

How to install yii2.0 basic and advanced application using composer and archived files
How to install yii2.0 basic and advanced application using composer and archived files

Currently, there are two Yii 2.0 application templates available:

  • Basic Application Template – a basic frontend application template.
  • Advanced Application Template – consisting of a frontend, a backend, console resources, common (shared code), and support for environments.

Before Installation:

  • Make sure you are using php version > php 5.4, if not upgrade it.
  • To enable or recompile php with openssl, Find line ;extension=php_openssl.dll in C:\wamp\bin\php\php.version\php.ini and uncomment it by removing the semicolon (;) from the beginning of the line.

Note: WAMP uses different php.ini files in the CLI and for Apache. when you enable php openssl through the WAMP UI, you enable it for Apache, not for the CLI. You need to modify C:\wamp\bin\php\php.version\php.ini to enable it for the CLI otherwise, it shows error “openssl extension is missing” while installing composer.

Installing Composer

Download and run https://getcomposer.org/Composer-Setup.exe
OR
on Linux or Mac, run the following commands:
curl -s http://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

To check the composer installation, Type the below code in command prompt
composer

yii2 Composer Installation

yii2 Composer Installation

Installing Yii2.0 Basic Application Template via composer

To install basic application template, make sure your command prompt directory pointing to web accessible folder c:/wamp/www and type the following command in command prompt.

c:\wamp\www> composer create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic yii2-basic
OR
c:\> composer create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic c:/wamp/www/yii2-basic

Create Yii2 Basic Template using Composer

Create Yii2 Basic Application Template using Composer

Folder Structure Of Basic Application Template

After installation of yii2.0 basic application template, you will get the folder structure like this.

Folder Structure of Yii2 Basic Template

Folder Structure of Yii2 Basic Application Template

Access your basic application template via http://localhost/yii2-basic/web

Installing Yii2.0 Advanced Application Template via composer

To create advanced application template, make sure your command prompt directory pointing to web accessible folder c:/wamp/www and type the following command in command prompt.
c:\>composer create-project --prefer-dist --stability=dev yiisoft/yii2-app-advanced c:/wamp/www/yii2advanced
OR
c:\wamp\www> composer create-project --prefer-dist --stability=dev yiisoft/yii2-app-advanced yii2advanced

Create Yii2 Advanced Template using Composer

Create Yii2 Advanced Template using Composer

Folder Structure Of Advanced Application Template

After installation of yii2.0 advanced application template, you will get the folder structure like this.

Folder Structure of Yii2 Advanced Application Template

Folder Structure of Yii2 Advanced Application Template

Installing Yii2.0 from an Archive File

  1. Download the archive file from yiiframework.com
  2. Unpack the downloaded file to a Web accessible folder.

Getting Started

  1. After installation of application, you have to follow these steps to initialize the installed application. You only need to do these once for all.
    type the following code in your command prompt to inititalise
    php c:/wamp/www/yii2advanced/init
    Yii2 Advanced Application Initialision

    Yii2 Advanced Application Initialision

  2. Create a new database and adjust the components.db configuration in C:/wamp/www/yii2advanced/common/config/main-local.php accordingly.
  3. Apply migrations with console command c:\wamp\www\yii2advanced> yii migrate
  4. Yii2 Migration

    Yii2 Migration

  5. Set document roots of your Web server:
    for frontend /path/to/yii-application/frontend/web/ [ In my case http://localhost/yii2advanced/frontend/web/index.php"
    for backend /path/to/yii-application/backend/web/ [ In my case http://localhost/yii2advanced/backend/web/]

Yii2.0 Advanced Application Frontend Template

Yii2 Advanced Application Frontend

Yii2 Advanced Application Frontend

Yii2.0 Advanced Application Backend Template

Yii2.0 Advanced Application Backend Template

Yii2.0 Advanced Application Backend Template

You may also like...

19 Responses

  1. Very nice article, exactly what I needed.

    Also visit my web page :: best male enhancement

  2. moein says:

    thanks for your article really useful and really help me.thanks again

  3. Web Developer says:

    Hi,
    I tried to install advanced version, but got installation error.
    See the error: http://postimg.org/image/fb4nayezf/

    Please helop

  4. Gloria says:

    I am reading your blog and an excellent method to promote your content came to my mind.
    Search in google for: Roman’s Tips – SM Traffic

  5. So I created a secondary blog off my first one, but I now want my secondary blog to be my personal or my main blog. So that as soon and I sign on the newer blog I made would be my default blog. If that makes any sense… Is there a way to do this?.

  6. I have learn some just right stuff here. Definitely worth bookmarking for revisiting.

    I wonder how a lot effort you place to make any such magnificent informative web site.

  7. I conceive this web site holds some real great information for everyone :D. “As ill-luck would have it.” by Miguel de Cervantes.

  8. Howdy very nice site!! Guy .. Beautiful .. Superb .. I will bookmark your web site and take the feeds additionally…I am happy to search out a lot of useful info here within the put up, we’d like work out more techniques in this regard, thanks for sharing.

  9. Julie says:

    Your blog can go viral, you need some initial traffic only.
    But how to get initial traffic??? Search in google for: Mamjo’s viral tool

  10. chithra says:

    thank you, sir….
    i start my yii2 project sucessfully

  11. My family always say that I am killing my time here at net, however I know I am getting experience everyday by reading these nice content.

  12. Israel says:

    I spent many futile hours trying to install yii. This site helped me out. Thanks

  1. July 3, 2014

    thanks for information!!

  2. November 13, 2014

    .

    good.

  3. November 14, 2014

    .

    thanks for information.

  4. March 31, 2015

    Simple and easy to understand.. Thanks again.

Leave a Reply

Your email address will not be published. Required fields are marked *