Setelah kita mencoba menggunakan PHP Composer, selanjutnya kita akan melakukan instalasi Yii2. Sesuai dengan informasi yang ada di websitenya, berikut langkah-langkah instalasi Yii 2 menggunakan composer

  1. Membuat folder yang sesuai misal yii2 dan jalankan perintah:
    composer global require “fxp/composer-asset-plugin:~1.1.1”

    Hasilnya
    D:\home\jqueryui18\public_html\yii2>composer global require “fxp/composer-asset-plugin:~1.1.1”
    Changed current directory to C:/Users/Wearnes/AppData/Roaming/Composer
    ./composer.json has been created
    Loading composer repositories with package information
    Updating dependencies (including require-dev)
      – Installing fxp/composer-asset-plugin (v1.1.4)
        Downloading: 100%

    Writing lock file
    Generating autoload files
      

  2. Membuat Githut Auth:
    Informasi ini berasal dari https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens .

    Perintahnya:
    composer config -g github-oauth.github.com a3-xxxxxxxxxxxxxxxxxxx-91

    Perhatikan a3-xxxxxxxxxxxxxxxxxxx-91 ganti dengan punya anda.

    Sebelumnya penulis mencoba install dan selalu ada peringatan:
    Could not fetch https://api.github.com/repos/jquery/jquery-dist, please create a
     GitHub OAuth token to go over the API rate limit
    Head to https://github.com/settings/tokens/new?scopes=repo&description=Composer+
    on+Wearnes-PC+2016-05-02+0806
    to retrieve a token. It will be stored in “C:/Users/Wearnes/AppData/Roaming/Comp
    oser/auth.json” for future use by Composer.
    Token (hidden):

    Hasil proses ini adalah auth.json yang isinya seperti berikut ini:
    {
        “bitbucket-oauth”: {},
        “github-oauth”: {
            “github.com”: “a3-xxxxxxxxxxxxxxxxxxx-91”},
        “gitlab-oauth”: {},
        “http-basic”: {}
    }

    Informasi ini berasal dari https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens .
     

  3. Menjalankan perintah:
    composer create-project –prefer-dist yiisoft/yii2-app-basic basic

    Hasilnya:
    D:\home\jqueryui18\public_html\yii2>composer create-project –prefer-dist yiisoft/yii2-app-basic basic
    Installing yiisoft/yii2-app-basic (2.0.8)
      – Installing yiisoft/yii2-app-basic (2.0.8)
        Loading from cache

    Created project in basic
    Loading composer repositories with package information
    Updating dependencies (including require-dev)
      – Installing yiisoft/yii2-composer (2.0.4)
        Downloading: 100%

      – Installing swiftmailer/swiftmailer (v5.4.2)
        Downloading: 100%

      – Installing bower-asset/jquery (2.2.3)
        Downloading: 100%

      – Installing bower-asset/yii2-pjax (v2.0.6)
        Downloading: 100%

      – Installing bower-asset/punycode (v1.3.2)
        Downloading: 100%

      – Installing bower-asset/jquery.inputmask (3.2.7)
        Downloading: 100%

      – Installing cebe/markdown (1.1.0)
        Downloading: 100%

      – Installing ezyang/htmlpurifier (v4.7.0)
        Downloading: 100%

      – Installing yiisoft/yii2 (2.0.8)
        Downloading: 100%

      – Installing yiisoft/yii2-swiftmailer (2.0.5)
        Downloading: 100%

      – Installing yiisoft/yii2-codeception (2.0.5)
        Downloading: 100%

      – Installing bower-asset/bootstrap (v3.3.5)
        Downloading: 100%

      – Installing yiisoft/yii2-bootstrap (2.0.6)
        Downloading: 100%

      – Installing yiisoft/yii2-debug (2.0.6)
        Downloading: 100%

      – Installing bower-asset/typeahead.js (v0.11.1)
        Downloading: 100%

      – Installing phpspec/php-diff (v1.1.0)
        Downloading: 100%

      – Installing yiisoft/yii2-gii (2.0.5)
        Downloading: 100%

      – Installing fzaninotto/faker (v1.6.0)
        Downloading: 100%

      – Installing yiisoft/yii2-faker (2.0.3)
        Downloading: 100%

    Writing lock file
    Generating autoload files
    > yii\composer\Installer::postCreateProject
    chmod(‘runtime’, 0777)…done.
    chmod(‘web/assets’, 0777)…done.
    chmod(‘yii’, 0755)…done.

    Hasil dari proses ini:

    Tampilan awal aplikasinya:

Informasi lebih lanjut silahkan mengunjungi:
1. http://www.yiiframework.com/doc-2.0/guide-start-installation.html .
2. https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens .

Kunjungi www.proweb.co.id untuk menambah wawasan anda.

Instalasi Yii 2 dengan Composer