Move sources to src

You are viewing revision #1 of this wiki article.
This version may not be up to date with the latest version.
You may want to view the differences to the latest version.

next (#2) »

Yii 3 and many Yii 2 package sources are contained within src directory which is convenient since you have less directories to check.

/config
/runtime
/src
  /assets
  /commands
  /controllers
  /mail
  /models
  /views
  /widgets
/tests
/vendor
/web
yii

Let's start with the basic applicaiton template.

  1. Create src directory.
  2. Move source directories there.
  3. Adjust config/web.php:
$config = [
    // ...
    'basePath' => dirname(__DIR__) . '/src',
    // ...
    'aliases' => [
        '@vendor' => dirname(__DIR__) . '/vendor',
        '@runtime' => dirname(__DIR__) . '/runtime',
        // ...
    ],
    // ...
];

And config/console.php:

$config = [
    // ...
    'basePath' => dirname(__DIR__) . '/src',
    // ...
    'aliases' => [
        '@vendor' => dirname(__DIR__) . '/vendor',
        '@runtime' => dirname(__DIR__) . '/runtime',
        // ...
    ],
    // ...
];

That's it now you have both console and web application source code in src.

11 0
6 followers
Viewed: 14 440 times
Version: 2.0
Category: How-tos
Written by: samdark
Last updated by: samdark
Created on: Aug 20, 2019
Last updated: 4 years ago
Update Article

Revisions

View all history

Related Articles