Changing the Yii directory layout
By default, we have the Basic and Advanced Yii2 application skeletons with different directory structures. But these structures are not dogmatic, and we can customize them if required.
For example, we can move the runtime directory out of the project.
Getting ready
Create a new yii2-app-basic
application by using the Composer the package manager, as described in the official guide at http://www.yiiframework.com/doc-2.0/guidestart-installation.html.
How to do it...
Changing the location of the runtime directory
Open config/web.php
and config/console.php
and define the runtimePath
parameter:
$config = [ 'id' => 'basic', 'basePath' => dirname(__DIR__), 'bootstrap' => ['log'], 'runtimePath' => '/tmp/runtime', 'components' => [ // ... ], ]
Move the runtime directory to the new location.
Changing the location of the vendor directory
- Open
config...