Yii2 dev digest #8 May-Jun'14

Jun 10, 2014, 7:57:23 PM

May was a good time for a barbeque and trekking :) So here is a brief digest, hopefully not so much news means more bugfix and docs work from Yii Team towards stable RC.

Try Yii2 in one click with Vagrant VM + Ansible provisioning

See all details in my previous post.. All software you wanted to try with Yii2 installed and provisioned out of the box.
In two words :
"Try Yii2" provides you with Vagrant file and Ansible provsioning scripts. Vagrant will launch the VirtualBox VM, download OS image, deploy it and then run Ansible. It will set up all needed software inside Linux VM, clone Yii2 project, download test DB and connect it with project. Also Vagrant will modify you hosts file and assign special local domain adresses with VM IP address, so you will be able to access test Yii2 prject by humanreadable local domain name. All these steps will be made completely automatically, just run vagrant up and wait !

Yii2 Extensions

Yii2 Tips & Tricks

$handler = new \app\components\ApiErrorHandler;
        \Yii::$app->set('errorHandler', $handler);
'rules' => [
                   'class' => 'yii\rest\UrlRule',
                   'controller' => 'user', 
                   'tokens' => ['{id}' => '<id:[a-z0-9]*>']
  • How can i pass params for layout for breadcrumbs?

    In controller: $this->view->params['breadcrumbs'] = [...]; In view: print_r($this->params['breadcrumbs']);

  • How do i include image file using assets?

    After you call $bundle = YourAssetBundle::register($this);, you can use $bundle->baseUrl and prefix it to the image path in the image tag. Yii won't do automatic replacement like you said. Unless you are developing an extension, you normally don't need to put images in an asset bundle. You should directly put them under Web accessible folders.

Read previous digests

comments powered by Disqus
Kuzminov "iJackUA"
Web Team Lead
at MobiDev (Kharkiv, Ukraine)
Code in Ruby and Elixir, but still love PHP. Explore ES6 and Vue.js. Explore databases, use Ubuntu and MacOS, think about IT people and management


Skaffold tool that facilitates continuous development for Kubernetes-native applications. Continuously deploys to your local or remote Kubernetes cluster.

DoItLive is a tool for live presentations in the terminal. It reads a file of shell commands and replays the commands in a fake terminal session as you type random characters.