PHP? ??? ?? (DI)? ?? ???, ??? ??? ? ?? ??? ??????. 1) ?? ????? ????? ? ? ??? ?? ??? ?? ?? ? ? ????. 2) DI? ???? ?? ????? ?? ??? ? ??? ????? ???? ????? ? ? ????? ????. 3) ??? ??? ?????? ?? ?????? ????? ??? ???? ??????.
PHP? ??? ?? (DI)? ????, ??? ??? ??? ?? ?????. ??? ??? ??? ??? ???? ?? ???? ??? ???? ??? ?????. ??? ??? ??? ?? ?? ???? ?? ??????? ????? ??? ???? ?? ???? ?? ????. ??? ? PHP?? DI? ??? ??????? ??? ?? ??? ?? ?? ??? ?????. ??? ??? ????? ??? ??? ?? ???? ?? ?? ????? ???? ????.
PHP?? ??? ??? ??? ?? ??? ??? ??? ???? ??? ??? What-If? ?? ? ????. ?? ???? ???? ??? ?????, ??? ???? ??? ??? ? ???? ??? ??? ?? ?? ?? ????.
PHP ?? ???? DI (Dependency Injection)? ?? ????? ????? ??? ?????. ?? ???? ??? ???? ??? ?? ?? ??? ??? ? ??? ?????? ?? ? ? ?? ?? ???? ? ?????. PHP? DI? ???? ???? ?? ????. ?? ??? ?? ?? ? ??? ???? ??? ????.
??? ?????? : ??? ????? ???? ??? ??? ?? ??? ?????. DI? ???? ? ??? ?? ??? ???? ?? ??????. ?? ?????? ?? ???? ????? ?????. DI ??? ?? ???? ????? ? ?? ??? ???? ??????.
DI? ? ??? ? ?? ??? ?? ?????.
// di?? ??? ??? ??? { ?? $ ??????; ?? ?? __construct () { $ this-> database = new MySqlDatabase (); } ?? ?? getUser ($ id) { $ this-> database-> query ( "select * where id =?", [$ id]); } } // di? ?? ??? ??? ??? { ?? $ ??????; public function __construct (databaseinterface $ database) { $ this-> ?????? = $ ??????; } ?? ?? getUser ($ id) { $ this-> database-> query ( "select * where id =?", [$ id]); } }
DI ???? ?? ?????? ???? UserService
??????. ? ???? ?? ????? ????? ?? ?? ? ? ????.
??? DI? ??? ??? ????. ??? ???? ??? ???? ???? ????. ???? ?? ?? ???? ???? ???? ???? ?? ?? ????? ???? ??????. ??? ????, ??? ??? ???? ?? ?? ?? ??? ? ? ????.
DI? ??? ?? ??? ????. ?? ??? ?? ? ? ???, ?? ????? ? ? ?? ???? ???? ? ? ????. ?? ?? ????? ?????? ?? ??? ??? ???? DI ????? ??? ? ????. ??? ????? ???? ??? ????.
psr \ container \ containerinterface? ??????. ??? ????? ContainerInterface { ?? $ ??? = []; ?? ?? get ($ id) { if (! isset ($ this-> services [$ id])) { New \ Exception ( "service {$ id} ?? ? ??")? ?????. } $ this-> services [$ id]; } ?? ??? ($ id) { ?? ISSET ($ this-> Services [$ id]); } ?? ?? ?? ($ id, $ service) { $ this-> ??? [$ id] = $ ???; } } $ ???? = ??? ???? (); $ ????-> set ( '??????', ??? mysqldatabase ()); $ ????-> set ( 'userService', new UserserVice ($ ????-> get ( 'database'))); $ userervice = $ container-> get ( 'userservice'); $ user = $ userService-> getUser (1);
????? ???? ?? ??? ????? ?? ???? ? ? ??? ???? ??? ???? ?? ?????. ????? ??? ?? ???? ??? ?? ? ? ????. ??? ??? ??? ? ?? ??? ? ?? ???? ???? ?? ???? ? ??? ?? ????? ??? ??? ????? ? ??????.
?? ???? DI? ?? ????? ??? ? ??? ?? ??? ?? ? ? ????. ??? ???? ?? ??? ???? ?? ???. ?? ??? DI ??? ???? ??????? ???? ????? ??? ??? ??? ???? ????.
???? ?? ?? ??? ?????? ????? ??? ???? ?? ????. ??? ????? ?? ?? ?? ? ??????. ? ? ??? ?? ????? ?? ??? ?? ? ? ????. ???? ??? ???? ??? ???? ???? ???? ?? ???? ????.
? ??? DI? ?? ? ??? ???? ????. DI? ???? ?? ???? ???? ?? ???? ??? ??????. ???? ?? ???? ?????? ???? ? ???? ????. ??? DI? ???? ????? ??? ?? ?? ????.
??? userervicetest? phpUnit \ framework \ testcase { ?? ?? testGetUser () { $ mockdatabase = $ this-> createmock (databaseInterface :: class); $ mockdatabase-> ?? ($ this-> ??? ()) -> ??? ( '??') -> with ( "select * where id =?", [1]) -> WillReturn ([ 'id'=> 1, 'name'=> 'John Doe']); $ userervice = new Userservice ($ mockdatabase); $ user = $ userService-> getUser (1); $ this-> AsserTequals ([ 'id'=> 1, 'name'=> 'John Doe'], $ user); } }
DI? ???? ? ?? ??? ???? ?? ????. ????? ????? ????? ???? ????. ??? ???? ????? ????? ????? ????? ? ???? ??? ????.
??? PHP? ????? ??? ????, ??? ??? ???????. ??? ?? ?? ??? ?? ?? ????.
? ??? PHP? ??? ?? : ??? ? ???? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

??? ??











? ?? ????? ??? ??? ????, ??? ??? ???? ??? ? ?? ?? ??? ????, Angular? ??? ?? ?????? ?? ???? ????. ????? ??? ??? ????.

Phalcon ??????? ??? ??(DependencyInjection)? ???? ?? ??: ?? ????? ???? ??? ??(DependencyInjection)? ??? ?? ???? ??? ???? ????? ?? ??? ?? ???? ??? ?????. ??? ??? PHP ?????? Phalcon ?????? ??? ??? ???? ?????? ???? ???? ???? ??? ?????. ? ???? Phalcon ?????? ???? ??? ?????.

??: Go ????? ?????? ??? ?? ??? ??? ??? ? ????. ??? ??? ???? ?????? ?????. ? ?????? ???? ??? ????. ?????? ?? ??? ????? ???? ?????. ??? ?? ??? ?????? ???? ?? ??? ? ????.

JUnit? ???? ??? ??? ????? ?? ??? ??? ????. ?? ??? ???? ??? ??: @Mock ??? ???? ?? ??? ??? ? ????. ??? ??? ??: @Before ???? ? ??? ??? ??? ???? ??? ???? ???? ? ?????. ?? ?? ??: Mockito.when() ???? ?? ??? ?? ??? ?????. ?? ??: AssertEquals()? ?? ??? ?? ?? ????? ???? ?? ??????. ?? ??: ??? ?? ?????(?: Spring Framework)? ???? ???? ???? JUnit ?? ???? ?? ??? ???? ??? ???? ??? ??? ? ????.

Go?? DI(??? ??) ??? ? ?? ? ??? ??? ??? ?? ???? ??? ?? ?????. DI ???? ???? ????? ????? ???? ?? ??? ??? ??? ???? ???? ?? ???? ?????. ???? ???? ??? ????? ???? ???? ??? ???? ???? ?????. ?? ??? ??? ? ?? ??? ?? ????? ?? ?? ??? ????. ?? DI ??? ???? ???? ?? ??? ? ???? DI ??? ???? ??? ?? ?? ???? ?? ??? ? ????.

PHP?? ??? ?? (DI)? ???? ?? ?? ???? ?? ? ??? ????? ??? ????. DI? ?? ??? ???? ???? ?? ??? ?? ???? ???? ??? ?? ?? ???? ????. DI? ???? ?? ???, ?? ??? ??? ?? ?????? ?? ???? ???? IOC ????? ?? ?? ??? ??? ? ???? ?? ? ? ??????.

aphpdectionenceindectioncontainerisatoolthatmanagesclassdependencies, ?? Codemodularity, testability ? maintainability.itactAsacentralHubForCreatingAndingDinjectingDingingDingingdecting.

??? ?? ???? (DIC)? PHP ????? ?????? ?? ???? ???? ???? ?????. DIC? ?? ???? ??? ?????. 1. ????, ?? ?? ??? ? ??? ?? ?? ? ???? ????. 2. ???, ???? ?? ?? ???? ????. 3. ??? ???, ?? ???? ?? ?? ??? ????? ?????.
