官术网_书友最值得收藏!

Services and the dependency injection container

Another architecturally important element of Drupal 8 is the Symfony dependency injection component (http://symfony.com/doc/current/components/dependency_injection.html), specifically represented by the service container.

This component is a staple of modern OOP PHP programming and as such has become foundational to Drupal 8. It allows us to create services that can be injected in various places of our code in order to handle certain functional (and oftentimes swappable) tasks. Additionally, they can also be used as an extension point because the service container is able to group services that have very specific responsibilities and use them for that automatically. In other words, simply by defining a simple service, we can provide our own functionality or even change existing logic.

We will encounter many services, and we will see how we can declare our own later in this book.

主站蜘蛛池模板: 吉安县| 关岭| 连南| 海兴县| 湛江市| 安远县| 大港区| 临朐县| 榕江县| 泰宁县| 红安县| 康马县| 敦化市| 延长县| 铁力市| 保靖县| 江孜县| 兰坪| 顺义区| 古交市| 江都市| 临汾市| 长子县| 黎平县| 道孚县| 榆林市| 博湖县| 徐闻县| 友谊县| 冀州市| 仁布县| 连城县| 仲巴县| 武平县| 拉萨市| 潍坊市| 清水县| 资源县| 辛集市| 横峰县| 江川县|