Creating an application in Yii3 - part 1 introduction.
Tags: php, yii3, yiiframework
Published: 2023-01-05 18:53:22

**Yii3** are a set of **agnostic packages** that facilitate the creation of a **web** application, **API** or **console**. Its strength is to use what we only need, in this way, we will only have dependencies that we will use throughout the development of our project.

We are now going to give an explanation of the packages that make up a standard application in Yii3:

**Yii Application Template:** [Template Yii3](https://github.com/yiisoft/app)

1. [HTTP Message](https://github.com/httpsoft/http-message). This package is a lightweight, fast, high-performance and strict implementation of the [PSR-7 HTTP Message](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-7-http-message.md) and [PSR-17 HTTP Factories](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-17-http-factory.md).
2. [Container interface](https://github.com/php-fig/container). This repository holds all interfaces related to [PSR-11 (Container Interface)](https://www.php-fig.org/psr/psr-11/).
3. [PSR Http Message.](https://github.com/php-fig/http-message) This repository holds all interfaces/classes/traits related to [PSR-7](http://www.php-fig.org/psr/psr-7/).
4. [HTTP Server Request Handlers for Middleware.](https://github.com/php-fig/http-server-handler) This repository holds the `RequestHandlerInterface` related to [PSR-15 (HTTP Server Request Handlers)](https://www.php-fig.org/psr/psr-15/).
5. [Symfony console component.](https://github.com/symfony/console) The Console component eases the creation of beautiful and testable command line interfaces.
6. [PHP dotenv.](https://github.com/vlucas/phpdotenv) Loads environment variables from `.env` to `getenv(), $_ENV` and `$_SERVER`
automagically.
7. [Yii aliases.](https://github.com/yiisoft/aliases) The package aim is to store path aliases, i.e. short name representing a long path (a file path, a URL, etc.). Path alias value may have another value as its part. For  example, `@vendor` may store path to `vendor` directory while `@bin` may store `@vendor/bin`.
8. [Yii assets.](https://github.com/yiisoft/assets) The package implements client-side asset (such as CSS and JavaScript) management for PHP. It helps resolve dependencies and get lists of files ready for generating HTML `<script>` and `<link>`tags.
9. [Yii cache.](https://github.com/yiisoft/cache) This library is a wrapper around [PSR-16](https://www.php-fig.org/psr/psr-16/) compatible caching libraries providing own features. It is used in [Yii Framework](https://www.yiiframework.com/)  but is usable separately.
10. [Yii cache-file.](https://github.com/yiisoft/cache-file) This package implements file-based [PSR-16](https://www.php-fig.org/psr/psr-16/) cache.
11. [Yii config.](https://github.com/yiisoft/config) This [Composer](https://getcomposer.org/) plugin provides assembling of configurations distributed with composer packages. It allows putting configuration needed to use a package right inside thus implementing a plugin system. The package becomes a plugin holding both the code and its configuration.
12. [Yii csrf.](https://github.com/yiisoft/csrf) The package provides [PSR-15](https://www.php-fig.org/psr/psr-15/) middleware for CSRF protection.
13. [Yii data-response.](https://github.com/yiisoft/data-response) The package allows responding with data that is automatically converted into [PSR-7](https://www.php-fig.org/psr/psr-7/) response.
14. [Yii definitions.](https://github.com/yiisoft/definitions) The package provides syntax constructs describing a way to create and configure a service or an object. It is used by [yiisoft/di](https://github.com/yiisoft/di) and [yiisoft/factory](https://github.com/yiisoft/factory) but could be used in other [PSR-11](https://www.php-fig.org/psr/psr-11/) compatible packages as well.
15. [Yii di.](https://github.com/yiisoft/di) [PSR-11](http://www.php-fig.org/psr/psr-11/) compatible [dependency injection](http://en.wikipedia.org/wiki/Dependency_injection) container that is able to instantiate and configure classes resolving dependencies.
16. [Yii error-handler.](https://github.com/yiisoft/error-handler) The package provides advanced error handling.
17. [Yii Factory.](https://github.com/yiisoft/factory) This package provides abstract object factory allowing to create objects by given definition with dependencies resolved by a [PSR-11](https://www.php-fig.org/psr/psr-11/) container.
18. [Yii files.](https://github.com/yiisoft/files) The package provides useful methods to manage files and directories.
19. [Yii html.](https://github.com/yiisoft/html) The package provides various tools to help with dynamic server-side generation of HTML.
20. [Yii http.](https://github.com/yiisoft/http) Constants for HTTP protocol headers, methods and statuses. All along with short descriptions and RFC links. PSR-7, PSR-17 PhpStorm meta for HTTP protocol headers, methods and statuses.`ContentDispositionHeader` that has static methods to generate `Content-Disposition` header name and value. `HeaderValueHelper` that has static methods to parse the header value parameters.
21. [Yii internationalization library.](https://github.com/yiisoft/i18n) The package provides common internationalization utilities: `Locale` stores locale information created from BCP 47 formatted string. Can parse locale string, modify locale parts, form locale string from parts, and derive fallback locale.
22. [Yii log.](https://github.com/yiisoft/log) This package provides [PSR-3](https://www.php-fig.org/psr/psr-3/) compatible logging library. It is used in [Yii Framework](http://www.yiiframework.com/)
 but is usable separately.
23. [Yii log-target-file.](https://github.com/yiisoft/log-target-file) This package provides the File target for the [yiisoft/log](https://github.com/yiisoft/log). The target: Records log messages in a file, allows you to configure log files rotation and provides the ability to compress rotated log files.
24. [Yii router](https://github.com/yiisoft/router). The package provides [PSR-7](https://www.php-fig.org/psr/psr-7/) compatible request routing and a [PSR-15 middleware](https://www.php-fig.org/psr/psr-15/)
ready to be used in an application. Instead of implementing routing from ground up, the package provides an interface for configuring routes and could be used with an adapter package. Currently, the only adapter available is [FastRoute](https://github.com/yiisoft/router-fastroute).
25. [Yii router-fastroute.](https://github.com/yiisoft/router-fastroute) The package provides FastRoute adapter for [Yii Router](https://github.com/yiisoft/router).
26. [Yii translator.](https://github.com/yiisoft/translator) This package allows translating messages into several languages. It can work with both Yii-based applications and standalone PHP applications.
27. [Yii translator-message-php.](https://github.com/yiisoft/translator-message-php) The package provides message storage backend based on PHP arrays to be used with `[yiisoft/translator](https://github.com/yiisoft/translator)` package.
28. [Yii view.](https://github.com/yiisoft/view) This library provides templates rendering abstraction supporting layout-view-subview hierarchy, custom renderers with PHP-based as default and more. It is used in [Yii Framework](https://www.yiiframework.com/) but is supposed to be usable separately.
29. [Yii console.](https://github.com/yiisoft/yii-console) This Yii Framework package provides a console that could be added to an application.
30. [Yii debug.](https://github.com/yiisoft/yii-debug)This extension provides a debugger for [Yii framework](http://www.yiiframework.com/) applications. When this extension is used, a debugger toolbar will appear at the bottom of every page. The extension also provides a set of standalone pages to display more detailed debug information.
31. [Yii event.](https://github.com/yiisoft/yii-event) This package is a configuration wrapper for the [yiisoft/event-dispatcher](https://github.com/yiisoft/event-dispatcher) package. It is intended to make event listener declaration simpler than you could ever imagine. All you need is to use any [PSR-11](https://www.php-fig.org/psr/psr-11/) compatible DI container.
32. [Yii yii-http.](https://github.com/yiisoft/yii-http) This Yii framework package provides the application class, as well as the events and handlers needed to interact with HTTP. The package is implemented using [PSR-7](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-7-http-message.md) interfaces.
33. [Yii yii-middleware.](https://github.com/yiisoft/yii-middleware) The package provides middleware classes that implement [PSR 15](https://github.com/php-fig/http-server-middleware). For more information on how to use middleware in the [Yii Framework](http://www.yiiframework.com/), see the [Yii middleware guide](https://github.com/yiisoft/docs/blob/master/guide/en/structure/middleware.md).
34. [Yii runner console.](https://github.com/yiisoft/yii-runner-console) The package contains a bootstrap for running Yii3 console application.
35. [Yii yii-runner.](https://github.com/yiisoft/yii-runner-http) The package contains a bootstrap for running Yii3 HTTP application.
36. [Yii yii-view.](https://github.com/yiisoft/yii-view) The package is an extension of the [Yii View Rendering Library](https://github.com/yiisoft/view/). It adds WEB-specific functionality and compatibility with [PSR-7](https://www.php-fig.org/psr/psr-7/) interfaces.

As we can see this composed of 36 packages, we can also see, that we can integrate third-party packages, without major problem, we just need to configure it in the container di.

In the next post, we will talk about how to create the application using **yiisoft/app**, in addition to explaining its configuration in detail.

Wilmer Arámbula.                                                                                                                         
[Team Developer YiiFramework](https://www.yiiframework.com/team)
[Twitter follow](https://twitter.com/Terabytesoftw)