Difference between #8 and #12 of
(draft) Understanding Yii 3

Changes

Title unchanged

(draft) Understanding Yii 3

Category unchanged

Tutorials

Yii version changed

all3.0

Tags unchanged

yii3

Content changed

# Understanding Yii 3 > Since this Wiki page is getting bigger and bigger, I decided to document things in a Yii 3 project instead.
 

 
> Project source can be found at https://github.com/machour/yii3-kitchen-sink
 
> <img src="" />
 
> Live web site: https://yii3.idk.tn/
 

 
> Follow the repo/website to get fresher informations, or better yet, pull the project and run it by yourself to get acquainted with Yii3
 
 
 
## Introduction
[...]
This re-organisation is also a great news for maintainance, as these packages will be released separately, thus allowing more frequent updates.

###
**Autoloading** The custom PHP class autoloader have been removed in favor of Composer's PSR-4 implementation. This means that in order for Yii to see your classes, you will have to explicitly register your namespace in `composer.json`. We will see an example later. ### **PSR compatibility** Yii 3 takes some positive steps following the [PHP-FIG](https://www.php-fig.org/) recommendations, by implementing the following PSRs:

* Logging is now compliant with PSR-3
[...]
* Dependency Injection is now compliant with PSR-11

###
**Application configuration** <small>[TODO]</small>If you've ever installed an extension using Yii 2, you may/certainly have found yourself on the extension README file, looking for the chunk of configuration to copy/paste in your own `config/main.php` file.
 
 
This can often lead to:
 
 
 * a huge configuration file (which you may have decided to split into smaller files)
 
 * non-trivials configurations update when a new version of the extension is realeased with new/changed configurations options.
 
 
Yii 3 takes another approach. Every package bundle its own configuration, and will probably work out of the box. And you may override them, if you need to, from your configuration file.
 
 
This is all done by leveraging the [hiqdev/composer-config-plugin](https://github.com/hiqdev/composer-config-plugin) composer plugin, which takes care of scanning & merging all the configurations when you run `composer dump-autoload` (also know as `composer du`).
 
 
You can read [Yii2 projects alternative organization](https://hiqdev.com/pages/articles/app-organization) for an in-depth explanation of the motivation behind `hiqdev/composer-config-plugin`.
 
 
Packages authors will have the responsibility to avoid introducing BC breaks, by adopting a strict sementical versionning.
### **Dependencies injection**

<small>[TODO]</small>
[...]
Let's introduce them briefly:

###
**The Framework**

* [yiisoft/yii-core](https://github.com/yiisoft/yii-core)
[...]
### **Librairies**

In Yii 3, libraries do **not** depend on Yii and are meant to be usable outside the framework.
[...]
* [yiisoft/db-elasticsearch](https://github.com/yiisoft/db-elasticsearch) Elastic

###
**Extensions**

Extensions depends (at least) on yii-core. Aside from the 3 extensions already encountered above (yii-console, yii-web, yii-api), these packages are available
[...]
Let's try running a web application using Yii 3, and the provided project template.

###
##  **Installing the project template**

```
[...]
> You could start from scratch using this bare template, select the extensions & packages you want to use and start developing, or you can pick one of the three starters provided.

###
##  **Installing the `web` starter**

Since we're doing a web application, we will need an asset manager. We can pick either one of those:
[...]
So where do what we see in the browser comes from ?

###
##  **Exploring yiisoft/yii-base-web structure:**

If you explore the folder in `vendor/yiisoft/yii-base-web`, you will see that the template is in fact a project itself, with this structure:

```
.
[...]
37 0
14 followers
Viewed: 54 785 times
Version: 3.0
Category: Tutorials
Tags: yii3
Written by: Mehdi Achour
Last updated by: samdark
Created on: Dec 16, 2018
Last updated: 5 months ago
Update Article

Revisions

View all history