Creating an application in Yii3 - part 3 the container di.

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • di

    PSR-11 compatible DI container and injector (by yiisoft)

  • Using the container di: Usage of the container di is fairly simple: You first initialize it with an array of definitions. The array keys are usually interface names. It will then use these definitions to create an object whenever that type is requested. This happens for example when fetching a type directly from the container somewhere in the application. But objects are also created implicitly if a definition has a dependency to another definition.

  • definitions

    The package provides definition syntax. Definition is describing a way to create and configure a service or an object.

  • Definitions is describing a way to create and configure a service, an object or return any other value. It must implement  Yiisoft\Definitions\Contract\DefinitionInterface that has a single method resolve(ContainerInterface $container).

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • app

    Yii3 application template (by yiisoft)

  • After explaining the functioning, it seems that the configurations are complex, but they are not, the container di, does all the work for you, applying the best practices, you just have to learn the syntax of the container and the references, and everything will be simple, now let's see the actual example in our app template.

  • config

    Configuration management (by yiisoft)

  • Now we understand how to do any configuration of any YiiFramework package or external, it is not necessary to have a single long and complex configuration file, we can organize it according to the group of configurations and Yii config will do the work for you, as well as the container it applies the definitions for you, with the automatic wiring facility in controllers, which makes it easy to access any container dependency without the need to use static access to it, or depend on the container itself.

  • Yii2

    Yii 2: The Fast, Secure and Professional PHP Framework

  • Now we understand how to do any configuration of any YiiFramework package or external, it is not necessary to have a single long and complex configuration file, we can organize it according to the group of configurations and Yii config will do the work for you, as well as the container it applies the definitions for you, with the automatic wiring facility in controllers, which makes it easy to access any container dependency without the need to use static access to it, or depend on the container itself.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts