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

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.

主站蜘蛛池模板: 宜丰县| 灯塔市| 友谊县| 夏津县| 方城县| 乌苏市| 介休市| 青浦区| 芜湖市| 长宁区| 雅安市| 大宁县| 剑川县| 盐源县| 凤庆县| 绥宁县| 德惠市| 垣曲县| 莱阳市| 濮阳市| 古浪县| 南木林县| 佳木斯市| 汉中市| 达尔| 观塘区| 怀仁县| 芦溪县| 平乡县| 抚远县| 佛山市| 永顺县| 政和县| 乌恰县| 璧山县| 鄂托克旗| 大庆市| 武陟县| 齐河县| 九江市| 永和县|