DEV Community

Cover image for Creating an application in Yii3 - part 1 introduction.
Wilmer Arambula
Wilmer Arambula

Posted on

Creating an application in Yii3 - part 1 introduction.

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

  1. HTTP Message. This package is a lightweight, fast, high-performance and strict implementation of the PSR-7 HTTP Message and PSR-17 HTTP Factories.
  2. Container interface. This repository holds all interfaces related to PSR-11 (Container Interface).
  3. PSR Http Message. This repository holds all interfaces/classes/traits related to PSR-7.
  4. HTTP Server Request Handlers for Middleware. This repository holds the RequestHandlerInterface related to PSR-15 (HTTP Server Request Handlers).
  5. Symfony console component. The Console component eases the creation of beautiful and testable command line interfaces.
  6. PHP dotenv. Loads environment variables from .env to getenv(), $_ENV and $_SERVER automagically.
  7. Yii 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. 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. This library is a wrapper around PSR-16 compatible caching libraries providing own features. It is used in Yii Framework  but is usable separately.
  10. Yii cache-file. This package implements file-based PSR-16 cache.
  11. Yii config. This Composer 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. The package provides PSR-15 middleware for CSRF protection.
  13. Yii data-response. The package allows responding with data that is automatically converted into PSR-7 response.
  14. Yii definitions. The package provides syntax constructs describing a way to create and configure a service or an object. It is used by yiisoft/di and yiisoft/factory but could be used in other PSR-11 compatible packages as well.
  15. Yii di. PSR-11 compatible dependency injection container that is able to instantiate and configure classes resolving dependencies.
  16. Yii error-handler. The package provides advanced error handling.
  17. Yii Factory. This package provides abstract object factory allowing to create objects by given definition with dependencies resolved by a PSR-11 container.
  18. Yii files. The package provides useful methods to manage files and directories.
  19. Yii html. The package provides various tools to help with dynamic server-side generation of HTML.
  20. Yii 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. 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. This package provides PSR-3 compatible logging library. It is used in Yii Framework  but is usable separately.
  23. Yii log-target-file. This package provides the File target for the 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. The package provides PSR-7 compatible request routing and a PSR-15 middleware 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.
  25. Yii router-fastroute. The package provides FastRoute adapter for Yii Router.
  26. Yii 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. 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. 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 but is supposed to be usable separately.
  29. Yii console. This Yii Framework package provides a console that could be added to an application.
  30. Yii debug.This extension provides a debugger for Yii framework 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. This package is a configuration wrapper for the 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 compatible DI container.
  32. Yii 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 interfaces.
  33. Yii yii-middleware. The package provides middleware classes that implement PSR 15. For more information on how to use middleware in the Yii Framework, see the Yii middleware guide.
  34. Yii runner console. The package contains a bootstrap for running Yii3 console application.
  35. Yii yii-runner. The package contains a bootstrap for running Yii3 HTTP application.
  36. Yii yii-view. The package is an extension of the Yii View Rendering Library. It adds WEB-specific functionality and compatibility with 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
Twitter follow

Top comments (0)