Instalasi YiiFramework


21/09/2017 11:16:29 135 Web

Yii Framework merupakan salah satu framework yang mulai saya pelajari sekitaran 2010 lalu. Pada saat itu, framework ini akan saya gunakan untuk menggantikan CodeIgniter dalam pembuatan aplikasi.

Instalasi YiiFramework via composer memerlukan plugin fxp/composer-asset-plugin:^1.2.0`, sehingga sebelum kita lanjutkan instalasi YiiFramework kita install terlebih dahulu paket ini bersama dengan dependency-nya sebagai berikut:

$ composer global require "fxp/composer-asset-plugin:^1.2.0"
Changed current directory to C:/Users/rofilde/AppData/Roaming/Composer
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing fxp/composer-asset-plugin (v1.4.0): Downloading (100%)
Writing lock file
Generating autoload files

Kemudian install YiiFramework dengan menggunakan perintah

composer create-project --prefer-dist yiisoft/yii2-app-basic basic
Installing yiisoft/yii2-app-basic (2.0.12)
  - Installing yiisoft/yii2-app-basic (2.0.12): Loading from cache
Created project in basic
Loading composer repositories with package information
Updating dependencies (including require-dev)

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+Rofil-Laptop+2017-09-19+2339
to retrieve a token. It will be stored in "C:/Users/rofilde/AppData/Roaming/Composer/auth.json" for future use by Composer.
Token (hidden):
Invalid token provided.
You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"

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+Rofil-Laptop+2017-09-19+2339
to retrieve a token. It will be stored in "C:/Users/rofilde/AppData/Roaming/Composer/auth.json" for future use by Composer.
Token (hidden):
Invalid token provided.
You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"

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+Rofil-Laptop+2017-09-19+2341
to retrieve a token. It will be stored in "C:/Users/rofilde/AppData/Roaming/Composer/auth.json" for future use by Composer.
Token (hidden):
Token stored successfully.
Package operations: 63 installs, 0 updates, 0 removals
  - Installing yiisoft/yii2-composer (2.0.5): Downloading (100%)
  - Installing swiftmailer/swiftmailer (v5.4.8): Loading from cache
  - Installing bower-asset/jquery (2.2.4): Downloading (100%)
  - Installing bower-asset/yii2-pjax (v2.0.6): Downloading (100%)
  - Installing bower-asset/punycode (v1.3.2): Downloading (100%)
  - Installing cebe/markdown (1.1.2): Downloading (100%)
  - Installing ezyang/htmlpurifier (v4.9.3): Downloading (100%)
  - Installing bower-asset/jquery.inputmask (3.3.8): Downloading (100%)
  - Installing yiisoft/yii2 (2.0.12): Downloading (100%)
  - Installing yiisoft/yii2-swiftmailer (2.0.7): Downloading (100%)
  - Installing bower-asset/bootstrap (v3.3.7): Downloading (100%)
  - Installing yiisoft/yii2-bootstrap (2.0.6): Downloading (100%)
  - Installing yiisoft/yii2-debug (2.0.11): 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.7.1): Downloading (100%)
  - Installing yiisoft/yii2-faker (2.0.3): Downloading (100%)
  - Installing psr/log (1.0.2): Loading from cache
  - Installing symfony/debug (v3.3.9): Downloading (100%)
  - Installing symfony/polyfill-mbstring (v1.5.0): Downloading (100%)
  - Installing symfony/console (v3.3.9): Downloading (100%)
  - Installing stecman/symfony-console-completion (0.7.0): Downloading (100%)
  - Installing sebastian/diff (1.4.3): Loading from cache
  - Installing sebastian/recursion-context (3.0.0): Loading from cache
  - Installing sebastian/exporter (3.1.0): Loading from cache
  - Installing sebastian/comparator (2.0.0): Downloading (100%)
  - Installing behat/gherkin (v4.4.5): Downloading (100%)
  - Installing symfony/dom-crawler (v3.3.9): Downloading (100%)
  - Installing symfony/css-selector (v3.3.9): Downloading (100%)
  - Installing symfony/browser-kit (v3.3.9): Downloading (100%)
  - Installing symfony/yaml (v3.3.9): Downloading (100%)
  - Installing symfony/event-dispatcher (v3.3.9): Downloading (100%)
  - Installing symfony/finder (v3.3.9): Downloading (100%)
  - Installing psr/http-message (1.0.1): Loading from cache
  - Installing guzzlehttp/psr7 (1.4.2): Loading from cache
  - Installing doctrine/instantiator (1.0.5): Loading from cache
  - Installing phpunit/php-text-template (1.2.1): Loading from cache
  - Installing phpunit/phpunit-mock-objects (4.0.4): Loading from cache
  - Installing theseer/tokenizer (1.1.0): Loading from cache
  - Installing sebastian/version (2.0.1): Loading from cache
  - Installing sebastian/environment (3.1.0): Loading from cache
  - Installing sebastian/code-unit-reverse-lookup (1.0.1): Loading from cache
  - Installing phpunit/php-token-stream (2.0.1): Loading from cache
  - Installing phpunit/php-file-iterator (1.4.2): Loading from cache
  - Installing phpunit/php-code-coverage (5.2.2): Loading from cache
  - Installing sebastian/resource-operations (1.0.0): Loading from cache
  - Installing sebastian/object-reflector (1.1.1): Loading from cache
  - Installing sebastian/object-enumerator (3.0.3): Loading from cache
  - Installing sebastian/global-state (2.0.0): Loading from cache
  - Installing phpunit/php-timer (1.0.9): Loading from cache
  - Installing webmozart/assert (1.2.0): Loading from cache
  - Installing phpdocumentor/reflection-common (1.0.1): Loading from cache
  - Installing phpdocumentor/type-resolver (0.4.0): Loading from cache
  - Installing phpdocumentor/reflection-docblock (4.1.1): Loading from cache
  - Installing phpspec/prophecy (v1.7.2): Loading from cache
  - Installing phar-io/version (1.0.1): Loading from cache
  - Installing phar-io/manifest (1.0.1): Loading from cache
  - Installing myclabs/deep-copy (1.6.1): Loading from cache
  - Installing phpunit/phpunit (6.2.4): Downloading (100%)
  - Installing codeception/base (2.3.5): Downloading (100%)
  - Installing codeception/verify (0.3.3): Downloading (100%)
  - Installing codeception/specify (0.4.6): Downloading (100%)
symfony/console suggests installing symfony/filesystem ()
symfony/console suggests installing symfony/process ()
symfony/browser-kit suggests installing symfony/process ()
symfony/event-dispatcher suggests installing symfony/dependency-injection ()
symfony/event-dispatcher suggests installing symfony/http-kernel ()
phpunit/phpunit-mock-objects suggests installing ext-soap (*)
phpunit/php-code-coverage suggests installing ext-xdebug (^2.5.5)
sebastian/global-state suggests installing ext-uopz (*)
phpunit/phpunit suggests installing phpunit/php-invoker (^1.1)
phpunit/phpunit suggests installing ext-xdebug (*)
codeception/base suggests installing flow/jsonpath (For using JSONPath in REST module)
codeception/base suggests installing phpseclib/phpseclib (for SFTP option in FTP Module)
codeception/base suggests installing league/factory-muffin (For DataFactory module)
codeception/base suggests installing league/factory-muffin-faker (For Faker support in DataFactory module)
codeception/base suggests installing symfony/phpunit-bridge (For phpunit-bridge support)
Writing lock file
Generating autoload files
> yii\composer\Installer::postCreateProject
chmod('runtime', 0777)...done.
chmod('web/assets', 0777)...done.
chmod('yii', 0755)...done.

Sedangkan ketika menginstal yiiframework versi advance ialah sebagai berikut:

$ composer create-project yiisoft/yii2-app-advanced advanced 2.0.12
Installing yiisoft/yii2-app-advanced (2.0.12)
  - Installing yiisoft/yii2-app-advanced (2.0.12): Loading from cache
Created project in advanced
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 62 installs, 0 updates, 0 removals
  - Installing yiisoft/yii2-composer (2.0.5): Loading from cache
  - Installing swiftmailer/swiftmailer (v5.4.8): Loading from cache
  - Installing bower-asset/jquery (2.2.4): Loading from cache
  - Installing bower-asset/yii2-pjax (v2.0.6): Loading from cache
  - Installing bower-asset/punycode (v1.3.2): Loading from cache
  - Installing cebe/markdown (1.1.2): Loading from cache
  - Installing ezyang/htmlpurifier (v4.9.3): Loading from cache
  - Installing bower-asset/jquery.inputmask (3.3.8): Loading from cache
  - Installing yiisoft/yii2 (2.0.12): Loading from cache
  - Installing yiisoft/yii2-swiftmailer (2.0.7): Loading from cache
  - Installing bower-asset/bootstrap (v3.3.7): Loading from cache
  - Installing yiisoft/yii2-bootstrap (2.0.6): Loading from cache
  - Installing yiisoft/yii2-debug (2.0.11): Loading from cache
  - Installing bower-asset/typeahead.js (v0.11.1): Loading from cache
  - Installing phpspec/php-diff (v1.1.0): Loading from cache
  - Installing yiisoft/yii2-gii (2.0.5): Loading from cache
  - Installing fzaninotto/faker (v1.7.1): Loading from cache
  - Installing yiisoft/yii2-faker (2.0.3): Loading from cache
  - Installing psr/log (1.0.2): Loading from cache
  - Installing symfony/debug (v3.3.9): Loading from cache
  - Installing symfony/polyfill-mbstring (v1.5.0): Loading from cache
  - Installing symfony/console (v3.3.9): Loading from cache
  - Installing stecman/symfony-console-completion (0.7.0): Loading from cache
  - Installing sebastian/diff (1.4.3): Loading from cache
  - Installing sebastian/recursion-context (3.0.0): Loading from cache
  - Installing sebastian/exporter (3.1.0): Loading from cache
  - Installing sebastian/comparator (2.0.0): Loading from cache
  - Installing behat/gherkin (v4.4.5): Loading from cache
  - Installing symfony/dom-crawler (v3.3.9): Loading from cache
  - Installing symfony/css-selector (v3.3.9): Loading from cache
  - Installing symfony/browser-kit (v3.3.9): Loading from cache
  - Installing symfony/yaml (v3.3.9): Loading from cache
  - Installing symfony/event-dispatcher (v3.3.9): Loading from cache
  - Installing symfony/finder (v3.3.9): Loading from cache
  - Installing psr/http-message (1.0.1): Loading from cache
  - Installing guzzlehttp/psr7 (1.4.2): Loading from cache
  - Installing doctrine/instantiator (1.0.5): Loading from cache
  - Installing phpunit/php-text-template (1.2.1): Loading from cache
  - Installing phpunit/phpunit-mock-objects (4.0.4): Loading from cache
  - Installing theseer/tokenizer (1.1.0): Loading from cache
  - Installing sebastian/version (2.0.1): Loading from cache
  - Installing sebastian/environment (3.1.0): Loading from cache
  - Installing sebastian/code-unit-reverse-lookup (1.0.1): Loading from cache
  - Installing phpunit/php-token-stream (2.0.1): Loading from cache
  - Installing phpunit/php-file-iterator (1.4.2): Loading from cache
  - Installing phpunit/php-code-coverage (5.2.2): Loading from cache
  - Installing sebastian/resource-operations (1.0.0): Loading from cache
  - Installing sebastian/object-reflector (1.1.1): Loading from cache
  - Installing sebastian/object-enumerator (3.0.3): Loading from cache
  - Installing sebastian/global-state (2.0.0): Loading from cache
  - Installing phpunit/php-timer (1.0.9): Loading from cache
  - Installing webmozart/assert (1.2.0): Loading from cache
  - Installing phpdocumentor/reflection-common (1.0.1): Loading from cache
  - Installing phpdocumentor/type-resolver (0.4.0): Loading from cache
  - Installing phpdocumentor/reflection-docblock (4.1.1): Loading from cache
  - Installing phpspec/prophecy (v1.7.2): Loading from cache
  - Installing phar-io/version (1.0.1): Loading from cache
  - Installing phar-io/manifest (1.0.1): Loading from cache
  - Installing myclabs/deep-copy (1.6.1): Loading from cache
  - Installing phpunit/phpunit (6.2.4): Loading from cache
  - Installing codeception/base (2.3.5): Loading from cache
  - Installing codeception/verify (0.3.3): Loading from cache
symfony/console suggests installing symfony/filesystem ()
symfony/console suggests installing symfony/process ()
symfony/browser-kit suggests installing symfony/process ()
symfony/event-dispatcher suggests installing symfony/dependency-injection ()
symfony/event-dispatcher suggests installing symfony/http-kernel ()
phpunit/phpunit-mock-objects suggests installing ext-soap (*)
phpunit/php-code-coverage suggests installing ext-xdebug (^2.5.5)
sebastian/global-state suggests installing ext-uopz (*)
phpunit/phpunit suggests installing phpunit/php-invoker (^1.1)
phpunit/phpunit suggests installing ext-xdebug (*)
codeception/base suggests installing codeception/specify (BDD-style code blocks)
codeception/base suggests installing flow/jsonpath (For using JSONPath in REST module)
codeception/base suggests installing phpseclib/phpseclib (for SFTP option in FTP Module)
codeception/base suggests installing league/factory-muffin (For DataFactory module)
codeception/base suggests installing league/factory-muffin-faker (For Faker support in DataFactory module)
codeception/base suggests installing symfony/phpunit-bridge (For phpunit-bridge support)
Writing lock file
Generating autoload files

Uji Coba

Setelah instalasi, masuk kedalam direktori cd basic. Untuk menjalankan yii framework dengan menggunakan perintah php yii serve