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

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.

主站蜘蛛池模板: 日喀则市| 聂拉木县| 蓝田县| 卢氏县| 霍山县| 德兴市| 肥东县| 海兴县| 祁阳县| 读书| 惠东县| 礼泉县| 炉霍县| 周至县| 剑阁县| 东源县| 内江市| 股票| 纳雍县| 怀来县| 区。| 黄石市| 乌拉特后旗| 濉溪县| 礼泉县| 同江市| 新宾| 咸宁市| 正镶白旗| 秦安县| 家居| 兴隆县| 新津县| 富民县| 漳平市| 合水县| 武清区| 金坛市| 东至县| 淮南市| 图们市|