Dependency InjectionãPHPã§ãæµè¡ã£ã¦ããããã§ããããæªã ã«ããããããªãã®ã§ãããããªãã¨ãããèªåãªãã«èå¯ãã¦ã¿ã¾ãã â»DIã³ã³ããã§ã¯ãªããã¶ã¤ã³ãã¿ã¼ã³ã¨ãã¦ã®DIãèãã¾ãã Dependency Injectionã¨ã¯ Dependency Injectionã¯ãã¶ã¤ã³ãã¿ã¼ã³ã®ä¸ç¨®ã§ããæ¥æ¬èªãªãä¾åæ§ã®æ³¨å ¥ã¨è¨³ããã¾ãããInversion of Control ã³ã³ãã㨠Dependency Injection ãã¿ã¼ã³ããåå ¸ã§ããããã ãã£ããè¦ç´ããã¨ãã¯ã©ã¹ã®ä¸ã§newãã¦ã¯ãããªããå¿ è¦ãªã¤ã³ã¹ã¿ã³ã¹ã¯å¤ããçªã£è¾¼ãã¹ããã¨ããã¨ããããªã class Y { private $x; function __construct() { $this->x = new X; } //...$xã使ã£ãã³ã¼ãè²ã ... } ä¸è¨ã®Yã¯ã©ã¹
{{#tags}}- {{label}}
{{/tags}}