{"id":443143,"date":"2024-12-26T05:33:27","date_gmt":"2024-12-26T05:33:27","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=443143"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=443143","title":{"rendered":"<span>\u0411\u0438\u0442\u0440\u0438\u043a\u0441: \u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u043a \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c 2<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e \u0432\u0441\u0435\u0445 \u043d\u0435\u0440\u0430\u0432\u043d\u043e\u0434\u0443\u0448\u043d\u044b\u0445! \u042f \u044f\u0432\u043b\u044f\u044e\u0441\u044c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u0435\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 DD Planet, \u0438 \u0441\u0435\u0433\u043e\u0434\u043d\u044f, \u043d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e, \u0434\u043e\u0448\u043b\u0438 \u0440\u0443\u043a\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438<\/p>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/824946\/\" target=\"_blank\" rel=\"noopener noreferrer nofollow\" class=\"embed_link embed_layout-right\"><\/p>\n<div class=\"embed__thumb\" style=\"background-image: url(&quot;https:\/\/habr.com\/share\/publication\/824946\/32c412d65aa03013a0639a49a887f1bc\/&quot;);\"><\/div>\n<div class=\"embed__caption\">\n<div class=\"embed__caption-title\"><span>\u0411\u0438\u0442\u0440\u0438\u043a\u0441: \u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u043a \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c<\/span><\/div>\n<div class=\"embed__caption-description\">\u041f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e \u0432\u0441\u0435\u0445 \u043d\u0435 \u0440\u0430\u0432\u043d\u043e\u0434\u0443\u0448\u043d\u044b\u0445! \u0425\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441 \u0432\u0430\u043c\u0438 \u0438\u0441\u0442\u043e\u0440\u0438\u0435\u0439 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043c\u044b \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043b\u0438 \u043a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a&#8230;<\/div>\n<p><span class=\"embed__caption-host\">habr.com<\/span><\/div>\n<p><\/a><\/p>\n<p>\u0412\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e DDD \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043c\u0435\u043d\u044b, \u0432\u044b\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044e \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c DI-\u043f\u043e\u0434\u0445\u043e\u0434.<\/p>\n<p>\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u044c \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 \u043d\u0430 DDD, \u0438 \u043f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u043c\u044b \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u0438\u043c\u0435\u043d \u0432 \u0444\u0430\u0439\u043b\u0435 init.php.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/060\/301\/5dd\/0603015dddb1f93db440877de7da0e5a.png\" width=\"769\" height=\"297\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/060\/301\/5dd\/0603015dddb1f93db440877de7da0e5a.png\"\/><\/figure>\n<p><strong>\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u043a\u043e\u043f\u043d\u0435\u043c \u0432 \u044d\u0442\u043e\u043c \u043c\u043e\u043c\u0435\u043d\u0442\u0435 \u043f\u043e\u0433\u043b\u0443\u0431\u0436\u0435!<\/strong><\/p>\n<p>\u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 DDD, \u044f \u043d\u0438 \u0438\u0437\u0443\u0447\u0430\u043b, \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0441\u044f \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u0442\u0435\u043e\u0440\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0432\u0441\u0435 \u0437\u043d\u0430\u0435\u043c, \u043d\u043e \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430 \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0432\u043e\u044f, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443:<\/p>\n<p><strong>1 \u0432\u0430\u0440\u0438\u0430\u043d\u0442. <\/strong>\u0410\u0432\u0442\u043e\u0440 \u0434\u0435\u043b\u0430\u0435\u0442 \u0434\u043e\u043c\u0435\u043d\u043d\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443, \u043e\u0442\u0434\u0435\u043b\u044f\u044f \u044f\u0434\u0440\u043e \u0438 \u043e\u0431\u0449\u0438\u0435 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443.<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e58\/370\/4b3\/e583704b3295913229d9417e2326af80.png\" width=\"486\" height=\"463\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e58\/370\/4b3\/e583704b3295913229d9417e2326af80.png\"\/><\/figure>\n<p><strong>2 \u0432\u0430\u0440\u0438\u0430\u043d\u0442.<\/strong> \u0410\u0432\u0442\u043e\u0440 \u0432\u044b\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u0432\u0441\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u044f \u043d\u0430 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043f\u0435\u0440\u0432\u044b\u0439 \u0441\u043b\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c \u0438\u0437 \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0435\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0439.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/838\/023\/d5b\/838023d5ba9ef8c083728ab4d691bd52.png\" width=\"621\" height=\"759\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/838\/023\/d5b\/838023d5ba9ef8c083728ab4d691bd52.png\"\/><\/figure>\n<p> \u00a0 \u00a0 <\/p>\n<p><strong>3 \u0432\u0430\u0440\u0438\u0430\u043d\u0442. <\/strong>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043d\u0430 \u0444\u0438\u0447\u0430\u0445, \u0433\u0434\u0435 \u043a\u0430\u0436\u0434\u0430\u044f \u0444\u0438\u0447\u0430 \u0436\u0438\u0432\u0451\u0442 \u0441\u0432\u043e\u0435\u0439 \u0436\u0438\u0437\u043d\u044c\u044e \u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u044b\u0435 \u043d\u0430\u0431\u043e\u0440\u044b, \u2014 \u0442\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0445\u043e\u0440\u043e\u0448 \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u0438\u043b\u0438\u0432\u0430\u043d\u0438\u044f \u043d\u0430 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u044b.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/dfd\/759\/d62\/dfd759d629462cf8ca779dc046f64f0a.png\" width=\"1430\" height=\"797\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/dfd\/759\/d62\/dfd759d629462cf8ca779dc046f64f0a.png\"\/><\/figure>\n<p><em>\u0421\u0441\u044b\u043b\u043a\u0438 \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <\/em><\/p>\n<div class=\"embed_link\">\n<div class=\"embed__thumb\" style=\"background-image: url(&quot;https:\/\/opengraph.githubassets.com\/181847bbe0e50eb0d69993b1dfc7554098d80db0fcbc5ceaa22270a2f074d30e\/franzose\/symfony-ddd-wishlist&quot;);\"><\/div>\n<div class=\"embed__caption\">\n<div class=\"embed__caption-title\"><span>symfony-ddd-wishlist\/src at master \u00b7 franzose\/symfony-ddd-wishlist<\/span><\/div>\n<p><a href=\"https:\/\/github.com\/franzose\/symfony-ddd-wishlist\/tree\/master\/src\" target=\"_blank\" rel=\"noopener noreferrer nofollow\" class=\"embed__caption-host\">github.com<\/a><\/div>\n<\/div>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/334126\/\" target=\"_blank\" rel=\"noopener noreferrer nofollow\" class=\"embed_link embed_layout-right\"><\/p>\n<div class=\"embed__thumb\" style=\"background-image: url(&quot;https:\/\/habr.com\/share\/publication\/334126\/a41381ebe596d750819b6dd1bbc6f84d\/&quot;);\"><\/div>\n<div class=\"embed__caption\">\n<div class=\"embed__caption-title\"><span>Domain Driven Design \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435<\/span><\/div>\n<div class=\"embed__caption-description\">\u042d\u0432\u0430\u043d\u0441 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0445\u043e\u0440\u043e\u0448\u0443\u044e \u043a\u043d\u0438\u0436\u043a\u0443 \u0441 \u0445\u043e\u0440\u043e\u0448\u0438\u043c\u0438 \u0438\u0434\u0435\u044f\u043c\u0438. \u041d\u043e \u044d\u0442\u0438\u043c \u0438\u0434\u0435\u044f\u043c \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043e\u0441\u043d\u043e\u0432\u044b. \u041e\u043f&#8230;<\/div>\n<p><span class=\"embed__caption-host\">habr.com<\/span><\/div>\n<p><\/a><a href=\"https:\/\/habr.com\/ru\/articles\/718916\/\" target=\"_blank\" rel=\"noopener noreferrer nofollow\" class=\"embed_link embed_layout-right\"><\/p>\n<div class=\"embed__thumb\" style=\"background-image: url(&quot;https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2a7\/0e5\/cd6\/2a70e5cd6f32c6734dd928af18fe696c.png&quot;);\"><\/div>\n<div class=\"embed__caption\">\n<div class=\"embed__caption-title\"><span>Clean Architecture, DDD, \u0433\u0435\u043a\u0441\u0430\u0433\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430. \u0420\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u043c \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 blog \u043d\u0430 Symfony<\/span><\/div>\n<div class=\"embed__caption-description\">\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442! \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \ud83d\ude09 \u042f \u0410\u043d\u044f, \u0438 \u044f php \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u0442\u0435\u043a &#8212; Magento. \u0421 \u043d\u0435\u0434\u0430\u0432\u043d\u0438\u0445 &#8230;<\/div>\n<p><span class=\"embed__caption-host\">habr.com<\/span><\/div>\n<p><\/a><\/p>\n<p>\u041f\u043e \u0438\u0442\u043e\u0433\u0443 \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0430 \u0441\u043b\u043e\u0438 \u0435\u0441\u0442\u044c, \u0430 \u0432\u043e\u0442 \u0432 \u043a\u0430\u043a\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u2014 \u044d\u0442\u043e \u043d\u0435 \u0441\u0442\u043e\u043b\u044c \u0432\u0430\u0436\u043d\u043e. \u0422\u0443\u0442 \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043f\u0440\u0438\u043c\u0435\u0440, \u0433\u0434\u0435 \u0432 \u043e\u0434\u043d\u043e\u043c \u0434\u043e\u043c\u0435\u043d\u0435 \u0441\u043e\u0431\u0440\u0430\u043d\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u0432\u0441\u0435, \u0438 \u044d\u0442\u043e, \u043d\u0430\u0434\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u0442\u044c, \u0442\u0430 \u0436\u0435 \u0441\u0430\u043c\u0430\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430, \u043a\u0430\u043a \u0438 \u0432 \u043f\u0443\u043d\u043a\u0442\u0435 3 \u0432\u044b\u0448\u0435:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/254\/061\/afe\/254061afe601c3878b34e26d8819d742.png\" width=\"250\" height=\"685\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/254\/061\/afe\/254061afe601c3878b34e26d8819d742.png\"\/><\/figure>\n<p>\u041a\u0430\u043a\u043e\u0439 \u043d\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u0432\u043e\u0434? \u041d\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439 \u0441\u0445\u0435\u043c\u044b \u2014 \u0435\u0441\u0442\u044c \u043b\u0438\u0448\u044c \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044f, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043d\u0430 \u043b\u043e\u0433\u0438\u043a\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0430\u0448\u0443 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443\u00a0<\/p>\n<blockquote>\n<p>local<\/p>\n<p>App<br \/> \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <u>Application <\/u>\u2014<u> \u0441\u0430\u043c \u0411\u0438\u0442\u0440\u0438\u043a\u0441 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u044d\u0442\u0438\u043c \u0441\u043b\u043e\u0435\u043c. \u041d\u0430\u043c \u043e\u043d \u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f.<\/u><\/p>\n<p>Domains \u2014 \u0441\u044e\u0434\u0430 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c \u043b\u043e\u0433\u0438\u043a\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p>Infrastructure \u2014 \u0442\u0443\u0442 \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0443\u0442 \u043b\u0435\u0436\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0439.<\/p>\n<p>Shared (Lib) \u2014 \u0442\u0443\u0442 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441\u044b, \u043e\u0431\u0449\u0438\u0435 \u043a\u0430\u043a \u0434\u043b\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0442\u0430\u043a \u0438 \u043b\u0435\u0433\u043a\u043e \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u044b\u0435 \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b, \u0438 \u0432\u0441\u044f\u043a\u0438\u0435 \u0445\u0435\u043b\u043f\u0435\u0440\u044b, \u043d\u0435 \u0437\u0430\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0443.<\/p>\n<\/blockquote>\n<p><strong>\u0421\u0435\u0440\u0432\u0438\u0441\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434:<\/strong><\/p>\n<p>\u0414\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0438 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043e\u043a \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u0438 \u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438, \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044f \u0441\u0432\u043e\u044e \u0444\u0430\u043d\u0442\u0430\u0437\u0438\u044e \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u043d\u043e \u043d\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044f\u0441\u044c \u0432 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u0445.<\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0440\u0430\u0437\u043d\u044b\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e:<\/p>\n<p><code>Layer\\ServiceName\\ServiceNameService::create($serviceId)-&gt;module()-&gt;methods()<\/code><\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:\u00a0<\/p>\n<p><code>App\\Domains\\Order\\OrderService::create()-&gt;repository()-&gt;getElementById($id);<\/code><\/p>\n<p><code>App\\Infrastructure\\Http\\HttpService::create(HTTPEnums::GUZZLE-&gt;value)-&gt;client()-&gt;send(array $body, Url $url)<\/code><\/p>\n<p><strong>\u041f\u0440\u0430\u043a\u0442\u0438\u043a\u0430<\/strong><\/p>\n<p><strong>1.\u00a0 <\/strong>\u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0441\u043c\u0435\u0440\u0434\u0436\u0438\u043c \u043d\u0430\u0448 composer.json \u0432 \u043f\u0430\u043f\u043a\u0435 local \u0441 \u0442\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443 \u043d\u0430\u0441 \u0432 \u044f\u0434\u0440\u0435, \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 merge-plugin, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043b\u0435\u0437\u0442\u044c \u0432 \u043f\u0430\u043f\u043a\u0443 bitrix \u0441 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0430\u043c\u0438.<\/p>\n<pre><code class=\"json\">{  \u00a0\"version\": \"1.0.0\",  \u00a0\"name\": \"name\",  \u00a0\"description\": \"description\",  \u00a0\"authors\": [  \u00a0\u00a0\u00a0{  \u00a0\u00a0\u00a0\u00a0\u00a0\"name\": \"name\",  \u00a0\u00a0\u00a0\u00a0\u00a0\"email\": \"email\"  \u00a0\u00a0\u00a0}  \u00a0],  \u00a0\"extra\": {  \u00a0\u00a0\u00a0\"installer-paths\": {  \u00a0\u00a0\u00a0\u00a0\u00a0\"modules\/{$name}\/\": [  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"type:bitrix-module\"  \u00a0\u00a0\u00a0\u00a0\u00a0]  \u00a0\u00a0\u00a0},  \u00a0\u00a0\u00a0\"merge-plugin\": {  \u00a0\u00a0\u00a0\u00a0\u00a0\"require\": [  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"..\/bitrix\/composer-bx.json\"  \u00a0\u00a0\u00a0\u00a0\u00a0]  \u00a0\u00a0\u00a0}  \u00a0},  \u00a0\"require\": {  \u00a0\u00a0\u00a0\"php\": \"&gt;=8.2\",  \u00a0\u00a0\u00a0\"psr\/container\": \"2.0\",  \u00a0\u00a0\u00a0\"psr\/http-client\": \"^1.0\",  \u00a0\u00a0\u00a0\"psr\/http-message\": \"^1.0\",  \u00a0\u00a0\u00a0\"psr\/log\": \"^3.0\",  \u00a0\u00a0\u00a0\"...\": \"...\",  \u00a0},  \u00a0\"config\": {  \u00a0\u00a0\u00a0\"vendor-dir\": \"..\/bitrix\/vendor\",  \u00a0\u00a0\u00a0\"allow-plugins\": {  \u00a0\u00a0\u00a0\u00a0\u00a0\"composer\/installers\": true,  \u00a0\u00a0\u00a0\u00a0\u00a0\"php-http\/discovery\": true  \u00a0\u00a0\u00a0}  \u00a0},  \u00a0\"require-dev\": {  \u00a0\u00a0\u00a0\"phpunit\/phpunit\": \"11.3.0\"  \u00a0},  \u00a0\"scripts\": {  \u00a0\u00a0\u00a0\"test\": \"phpunit\"  \u00a0}  }<\/code><\/pre>\n<p>\u0417\u0430\u0442\u0435\u043c \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0448\u0443 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0432\u0435\u043d\u0434\u043e\u0440\u043e\u0432 \u0432 \u0444\u0430\u0439\u043b\u0435 init.php, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e PSR-4:<\/p>\n<pre><code class=\"php\">use Bitrix\\Main\\Application;  use Bitrix\\Main\\Loader;  require(Application::getDocumentRoot() . \"\/bitrix\/vendor\/autoload.php\");  \/*****  * \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432.  *****\/  try {  \u00a0\u00a0\u00a0Loader::registerNamespace(  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"App\",  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Loader::getDocumentRoot() . \"\/local\/App\"  \u00a0\u00a0\u00a0);  } catch (LoaderException $e) {  LoggerFacade::app()-&gt;error('Error include namespace: ' . $e-&gt;getMessage());  throw new \\Exception($e-&gt;getMessage());  }<\/code><\/pre>\n<p><strong>\u0421\u043b\u043e\u0439 \u0434\u043e\u043c\u0435\u043d\u0430:<\/strong> \u0442\u0443\u0442 \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u043e\u043c\u0435\u043d \u0431\u0443\u0434\u0435\u0442 \u044f\u0432\u043b\u044f\u0442\u044c \u0438\u0437 \u0441\u0435\u0431\u044f \u043f\u043e\u043b\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0435\u043c\u0443 \u0434\u043b\u044f \u0436\u0438\u0437\u043d\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u0447\u0442\u043e\u0431\u044b \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043b\u0435\u0433\u043a\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u0440\u0430\u0441\u043f\u0438\u043b \u043d\u0430 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u044b.<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/715\/91f\/343\/71591f3430703029d84f3e113555d4d2.png\" width=\"306\" height=\"548\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/715\/91f\/343\/71591f3430703029d84f3e113555d4d2.png\"\/><\/figure>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u0434\u043e\u043c\u0435\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441, \u0434\u043b\u044f \u0435\u0434\u0438\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u044f\u043c\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0438\u0434\u0435\u0442 \u0447\u0435\u0440\u0435\u0437 \u043f\u0430\u0442\u0442\u0435\u0440\u043d <strong>&#171;\u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u0430\u044f \u0444\u0430\u0431\u0440\u0438\u043a\u0430&#187;<\/strong>, \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u043f\u0430\u0442\u0442\u0435\u0440\u043d <strong>&#171;\u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0444\u0430\u0431\u0440\u0438\u043a\u0430&#187;<\/strong> \u0438 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0441\u0430\u043c \u0441\u0435\u0431\u044f.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0434\u043e\u043c\u0435\u043d\u0430:<\/p>\n<pre><code class=\"php\">&lt;?php  namespace App\\Domains\\Contracts;  interface BaseServiceInterface  {  \u00a0\u00a0\u00a0\/**  \u00a0\u00a0\u00a0\u00a0* Method create service by key.  \u00a0\u00a0\u00a0\u00a0* @return mixed  \u00a0\u00a0\u00a0\u00a0*\/  \u00a0\u00a0\u00a0public static function create(): self;<\/code><\/pre>\n<p><\/p>\n<p>\u0418 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u043a\u043b\u0430\u0441\u0441\u0443:<\/p>\n<pre><code class=\"php\">&lt;?php  namespace App\\Domains\\Order\\Services;  use App\\Domains\\Contracts\\BaseServiceInterface;  use App\\Domains\\Order\\Services\\Exchange\\ExchangeService;  use App\\Domains\\Order\\Services\\Repository\\OrderRepository;  use App\\Shared\\DI\\Container;  use Bitrix\\Main\\ArgumentException;  readonly class OrderService implements BaseServiceInterface  {  \u00a0\u00a0\u00a0\/**  \u00a0\u00a0\u00a0\u00a0* @throws ArgumentException  \u00a0\u00a0\u00a0\u00a0*\/  \u00a0\u00a0\u00a0public static function create(): self  \u00a0\u00a0\u00a0{  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return (new Container())-&gt;get(self::class);  \u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0public function __construct(  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0private OrderRepository $repository,  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0private ExchangeService $exchangeService  \u00a0\u00a0\u00a0)  \u00a0\u00a0\u00a0{  \u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0public function repository(): OrderRepository  \u00a0\u00a0\u00a0{  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return $this-&gt;repository;  \u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0public function exchange(): ExchangeService  \u00a0\u00a0\u00a0{  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return $this-&gt;exchangeService;  \u00a0\u00a0\u00a0}  }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u0441\u0435\u0440\u0432\u0438\u0441\u0443 \u0438 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0432 \u043d\u0435\u0433\u043e \u0432\u043d\u0435\u0434\u0440\u0438\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 \u043f\u0430\u0442\u0442\u0435\u0440\u043d DI<\/p>\n<pre><code class=\"php\">public function __construct(  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0private OrderRepository $repository,  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0private ExchangeService $exchangeService  \u00a0\u00a0\u00a0)<\/code><\/pre>\n<p>\u0422\u0430\u043a, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043c\u0435\u0442\u043e\u0434\u0443 \u043f\u043e \u043f\u0443\u0442\u0438 <code>OrderService::create()-&gt;repository()-&gt;getDealRepositoryByDealId($id);<\/code><\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/bd7\/9d3\/0d8\/bd79d30d8ab57c054195df3e29a4389f.png\" width=\"1144\" height=\"617\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bd7\/9d3\/0d8\/bd79d30d8ab57c054195df3e29a4389f.png\"\/><\/figure>\n<p>\u041d\u043e \u0435\u0441\u043b\u0438 \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u0438, \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 create() \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a\u043e\u0439-\u0442\u043e Container()? \u0422\u0430\u043a \u0432\u043e\u0442, \u0435\u0441\u043b\u0438 \u043c\u044b \u0432\u0435\u0440\u043d\u0435\u043c DI-\u0438\u043d\u044a\u0435\u043a\u0446\u0438\u044e \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u0442\u043e \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0438 \u043d\u0430\u043c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u0432\u0441\u0435\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438, \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435, \u0447\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043a\u0440\u043e\u043f\u043e\u0442\u043b\u0438\u0432\u043e.<\/p>\n<p><code>return new self(new OrderRepository(), new ExchangeService());<\/code><\/p>\n<p>\u0415\u0441\u043b\u0438 \u0431\u0440\u0430\u0442\u044c symfony \u0438 laravel, \u0442\u043e \u0442\u0430\u043c \u044d\u0442\u043e \u0440\u0435\u0448\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0445\u0435\u043b\u043f\u0435\u0440\u043e\u0432 app(). \u0412\u043e\u0442 \u0432\u044b\u0434\u0435\u0440\u0436\u043a\u0430 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0439:<\/p>\n<blockquote>\n<p>If you are using it as in your example &#8212; you&#8217;ll get no profit. But Laravel container gives much more power in this resolving that you cannot achieve with simple instantiating objects.<\/p>\n<ol>\n<li>\n<p><strong>Binding Interface<\/strong> &#8212; you can bind specific interface and it&#8217;s implementation into container and resolve it as interface. This is useful for test-friendly code and flexibility &#8212; cause you can easily change implementation in one place without changing interface. (For example use some Countable interface everywhere as a target to resolve from container but receive it&#8217;s implementation instead.)<\/p>\n<\/li>\n<li>\n<p><strong>Dependency Injection<\/strong> &#8212; if you will bind class\/interface and ask it as a dependecy in some method\/constructor &#8212; Laravel will automatically insert it from container for you.<\/p>\n<\/li>\n<li>\n<p><strong>Conditional Binding<\/strong> &#8212; you can bind interface but depending on the situation resolve different implementations.<\/p>\n<\/li>\n<li>\n<p><strong>Singleton<\/strong> &#8212; you can bind some shared instance of an object.<\/p>\n<\/li>\n<li>\n<p><strong>Resolving Event<\/strong> &#8212; each time container resolves smth &#8212; it raises an event you can subscribe in other places of your project.<\/p>\n<\/li>\n<\/ol>\n<p>And many other practises&#8230; You can read more detailed here <a href=\"http:\/\/laravel.com\/docs\/5.1\/container\" rel=\"noopener noreferrer nofollow\"><u>http:\/\/laravel.com\/docs\/5.1\/container<\/u><\/a><\/p>\n<\/blockquote>\n<p>\u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u043c \u0432\u0435\u0440\u043d\u0435\u0442 \u0438\u043d\u0441\u0442\u0430\u043d\u0441 \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438:<\/p>\n<pre><code class=\"php\">&lt;?php  namespace App\\Shared\\DI;  use Bitrix\\Main\\ArgumentException;  use Exception;  use Psr\\Container\\ContainerExceptionInterface;  use Psr\\Container\\ContainerInterface;  use Psr\\Container\\NotFoundExceptionInterface;  use ReflectionClass;  use ReflectionException;  \/**  * \u041a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432.  * @package App\\Shared\\DI  *\/  class Container implements ContainerInterface  {  \u00a0\u00a0\u00a0private array $objects = [];  \u00a0\u00a0\u00a0\/**  \u00a0\u00a0\u00a0\u00a0* @inheritDoc  \u00a0\u00a0\u00a0\u00a0*\/  \u00a0\u00a0\u00a0public function has(string $id): bool  \u00a0\u00a0\u00a0{  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return isset($this-&gt;objects[$id]) || class_exists($id);  \u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0\/**  \u00a0\u00a0\u00a0\u00a0* \u041c\u0435\u0442\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0438\u043d\u0441\u0442\u0430\u043d\u0441 \u043a\u043b\u0430\u0441\u0441\u0430 \u043f\u043e \u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0443.  \u00a0\u00a0\u00a0\u00a0*  \u00a0\u00a0\u00a0\u00a0* @param string $id  \u00a0\u00a0\u00a0\u00a0* @return mixed  \u00a0\u00a0\u00a0\u00a0* @throws ArgumentException  \u00a0\u00a0\u00a0\u00a0*\/  \u00a0\u00a0\u00a0public function get(string $id): mixed  \u00a0\u00a0\u00a0{  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0try {  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0isset($this-&gt;objects[$id])  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0? $this-&gt;objects[$id]() \u00a0 \u00a0 \u00a0 \u00a0 \/\/ \"\u0421\u0442\u0430\u0440\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434\"  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0: $this-&gt;prepareObject($id); \/\/ \"\u041d\u043e\u0432\u044b\u0439\" \u043f\u043e\u0434\u0445\u043e\u0434  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0} catch (ContainerExceptionInterface|NotFoundExceptionInterface|Exception $exception) {  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0throw new ArgumentException($exception-&gt;getMessage());  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0\/**  \u00a0\u00a0\u00a0\u00a0* @throws Exception  \u00a0\u00a0\u00a0\u00a0*\/  \u00a0\u00a0\u00a0private function prepareObject(string $class): object  \u00a0\u00a0\u00a0{  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0try {  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$classReflector = new ReflectionClass($class);  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0440\u0435\u0444\u043b\u0435\u043a\u0442\u043e\u0440 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 \u043a\u043b\u0430\u0441\u0441\u0430, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c - \u0435\u0441\u0442\u044c \u043b\u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ \u0415\u0441\u043b\u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 \u043d\u0435\u0442 - \u0441\u0440\u0430\u0437\u0443 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$constructReflector = $classReflector-&gt;getConstructor();  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if (empty($constructReflector)) {  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return new $class;  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0440\u0435\u0444\u043b\u0435\u043a\u0442\u043e\u0440\u044b \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ \u0415\u0441\u043b\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0435\u0442 - \u0441\u0440\u0430\u0437\u0443 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$constructArguments = $constructReflector-&gt;getParameters();  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if (empty($constructArguments)) {  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return new $class;  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ \u041f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u043c \u0432\u0441\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430, \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$args = [];  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0foreach ($constructArguments as $argument) {  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0438\u043f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$argumentType = $argument-&gt;getType()-&gt;getName();  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u0430\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u043f\u043e \u0435\u0433\u043e \u0442\u0438\u043f\u0443 \u0438\u0437 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$args[$argument-&gt;getName()] = $this-&gt;get($argumentType);  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ \u0418 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u043c\u0438  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return new $class(...$args);  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0} catch (ReflectionException|ContainerExceptionInterface|NotFoundExceptionInterface $e) {  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0throw new Exception($e-&gt;getMessage());  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0}  }<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432\u0441\u0435 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0432 \u0441\u0435\u0440\u0432\u0438\u0441 \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u043e\u0434\u043d\u0438\u043c \u0438 \u0442\u0435\u043c \u0436\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c, \u0438 \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u0430\u0445, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432 \u0441\u0430\u043c\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u0430\u0445, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443:<\/p>\n<p><code>CurlService::create()-&gt;client()-&gt;setUrl($url);<\/code><\/p>\n<p><code>CurlService::create()-&gt;actions()-&gt;send($message);<\/code><\/p>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u0432 CurlActions \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u0438\u043d\u0441\u0442\u0430\u043d\u0441 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c:<\/p>\n<pre><code class=\"php\">readonly class CurlActions implements ActionsInterface  {  \u00a0\u00a0\u00a0\/**  \u00a0\u00a0\u00a0\u00a0* @throws ArgumentException  \u00a0\u00a0\u00a0\u00a0* @throws SystemException  \u00a0\u00a0\u00a0\u00a0*\/  \u00a0\u00a0\u00a0public function __construct(  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0private CurlClient $client  \u00a0\u00a0\u00a0)  \u00a0\u00a0\u00a0{  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$this-&gt;client-&gt;init();  \u00a0\u00a0\u00a0}<\/code><\/pre>\n<p><strong>2. \u0418\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u044b\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b<\/strong><\/p>\n<p>\u0420\u0430\u0437 \u043c\u044b \u0437\u0430\u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438 \u043e CURL, \u043e\u043d \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u0435\u043c \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u0435\u043c \u0436\u0435 Guzzle, \u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043b\u0435\u0433\u043a\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0437\u0430\u043c\u0435\u043d\u044f\u0435\u043c\u044b, \u043a\u0430\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u044b \u0421\u041c\u0421.<\/p>\n<p>\u0422\u0443\u0442 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0444\u0430\u0431\u0440\u0438\u043a\u0430, \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0430\u044f \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u0445, \u0430 \u043d\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0443 curl \u0438 guzzle \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043c\u0435\u0442\u043e\u0434 init(), \u043c\u0435\u0442\u043e\u0434 setBody() \u0438 \u043c\u0435\u0442\u043e\u0434 send(). \u0410 \u0432\u043e\u0442 \u0438\u0445 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0430\u0441 \u043c\u0430\u043b\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442.<\/p>\n<p>\u041f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430:<\/p>\n<pre><code class=\"php\">&lt;?php  namespace App\\Infrastructure\\Contracts;  interface BaseServiceInterface  {  \u00a0\u00a0\u00a0\/**  \u00a0\u00a0\u00a0\u00a0* Method create service by key.  \u00a0\u00a0\u00a0\u00a0* @param int $typeId\u00a0 ID \u0441\u0435\u0440\u0432\u0438\u0441\u0430.  \u00a0\u00a0\u00a0\u00a0* @return mixed  \u00a0\u00a0\u00a0\u00a0*\/  \u00a0\u00a0\u00a0public static function create(int $typeId): mixed;  }<\/code><\/pre>\n<p>\u0427\u0435\u0440\u0435\u0437 <code>$typeId<\/code> \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c, \u043a\u0430\u043a\u043e\u0439 \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0438\u043f \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c. \u0427\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043d\u0435 \u0437\u0430\u043f\u0443\u0442\u0430\u043b\u0438\u0441\u044c \u0432 \u0442\u043e\u043c, \u043a\u0430\u043a\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u043a\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f, \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0432 Enums:<\/p>\n<pre><code class=\"php\">&lt;?php  namespace App\\Infrastructure\\Enums\\Http;  enum ServicesEnums : int  {  \u00a0\u00a0\u00a0case CURL = 1;  \u00a0\u00a0\u00a0case GUZZLE = 2;  }<\/code><\/pre>\n<p>\u0418 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u0441 \u0438\u043d\u044a\u0435\u043a\u0446\u0438\u044f\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c:<\/p>\n<pre><code class=\"php\">&lt;?php  namespace App\\Infrastructure\\Contracts\\Http;  interface ServiceInterface  {  \u00a0\u00a0\u00a0public function client(): ClientInterface;  \u00a0\u00a0\u00a0public function repository(): RepositoryInterface;  \u00a0\u00a0\u00a0public function actions(): ActionsInterface;  }<\/code><\/pre>\n<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0435\u0440\u0432\u0438\u0441 \u0438 \u0432 \u043d\u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0442\u0438\u043f:<\/p>\n<pre><code class=\"php\">&lt;?php  namespace App\\Infrastructure\\Services\\Http;  use App\\Infrastructure\\Contracts\\BaseServiceInterface;  use App\\Infrastructure\\Contracts\\Http\\HttpRequestInterface;  use App\\Infrastructure\\Contracts\\Http\\ServiceInterface;  use App\\Infrastructure\\Enums\\Http\\ServicesEnums;  use App\\Infrastructure\\Enums\\Logger\\TypeEnums;  use App\\Infrastructure\\Services\\Http\\Curl\\CurlService;  use App\\Infrastructure\\Services\\Http\\Guzzle\\GuzzleService;  use App\\Shared\\DI\\Container;  use Exception;  class HttpService implements BaseServiceInterface  {  \u00a0\u00a0\u00a0\/**  \u00a0\u00a0\u00a0\u00a0* @throws Exception  \u00a0\u00a0\u00a0\u00a0*\/  \u00a0\u00a0\u00a0public static function create(int $typeId = ServicesEnums::CURL-&gt;value): ServiceInterface  \u00a0\u00a0\u00a0{  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return match ($typeId) {  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0ServicesEnums::CURL-&gt;value =&gt; (new Container())-&gt;get(CurlService::class),  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0ServicesEnums::GUZZLE-&gt;value =&gt; (new Container())-&gt;get(GuzzleService::class),  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0default =&gt; throw new Exception('Unexpected match value'),  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0};  \u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0\/**  \u00a0\u00a0\u00a0\u00a0* \u041b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u043c\u0435\u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438.  \u00a0\u00a0\u00a0\u00a0*  \u00a0\u00a0\u00a0\u00a0* @param HttpRequestInterface $context  \u00a0\u00a0\u00a0\u00a0* @param TypeEnums $type \u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u043b\u043e\u0433\u043e\u0432.  \u00a0\u00a0\u00a0\u00a0* @return void  \u00a0\u00a0\u00a0\u00a0*\/  \u00a0\u00a0\u00a0public static function log(HttpRequestInterface $context, TypeEnums $type = TypeEnums::ORDERS): void  \u00a0\u00a0\u00a0{  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$method = debug_backtrace()[1]['function'];  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$message = \"Http: {$context-&gt;method}::{$method} [{$context-&gt;id_entity}]\";  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0LoggerFacade::app('Http' . DIRECTORY_SEPARATOR . $context-&gt;service . DIRECTORY_SEPARATOR . $type-&gt;name . DIRECTORY_SEPARATOR )-&gt;info($message, (array)$context);  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0LoggerFacade::elk()-&gt;info($message, (array)$context);  \u00a0\u00a0\u00a0}  }<\/code><\/pre>\n<p>\u00a0<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u044b \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043f\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043e\u0431\u0449\u0438\u0435 \u0434\u043b\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/eb7\/de9\/531\/eb7de95314b53ac4daf2c48f556cfc87.png\" width=\"1006\" height=\"887\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/eb7\/de9\/531\/eb7de95314b53ac4daf2c48f556cfc87.png\"\/><\/figure>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u0438\u043d\u044a\u0435\u043a\u0446\u0438\u0438:<\/p>\n<pre><code class=\"php\">&lt;?php  namespace App\\Infrastructure\\Services\\Http\\Curl;  use App\\Infrastructure\\Contracts\\Http\\RepositoryInterface;  use App\\Infrastructure\\Contracts\\Http\\ServiceInterface;  use App\\Infrastructure\\Services\\Http\\Curl\\Actions\\CurlActions;  use App\\Infrastructure\\Services\\Http\\Curl\\Client\\CurlClient;  readonly class CurlService implements ServiceInterface  {  \u00a0\u00a0\u00a0public function __construct(  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0private CurlClient\u00a0 $client,  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0private CurlActions $actions,  \u00a0\u00a0\u00a0)  \u00a0\u00a0\u00a0{  \u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0public function client(): CurlClient  \u00a0\u00a0\u00a0{  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return $this-&gt;client;  \u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0public function repository(): RepositoryInterface  \u00a0\u00a0\u00a0{  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ TODO: Implement repository() method.  \u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0public function actions(): CurlActions  \u00a0\u00a0\u00a0{  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return $this-&gt;actions;  \u00a0\u00a0\u00a0}  }<\/code><\/pre>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u043d\u0430\u0431\u043e\u0440 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043e\u0432 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0438\u043c\u0435\u043b\u0438 \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e, \u0430 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b.<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/633\/772\/4d1\/6337724d1609f36af132cdf92cb7496d.png\" width=\"333\" height=\"368\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/633\/772\/4d1\/6337724d1609f36af132cdf92cb7496d.png\"\/><\/figure>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0443\u0436\u0435 \u043f\u043e \u0442\u043e\u043c\u0443 \u043f\u0443\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043b\u0441\u044f \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435:<\/p>\n<p><code>App\\Infrastructure\\Http\\HttpService::create(HTTPEnums::GUZZLE-&gt;value)-&gt;client()-&gt;send( $body, $url)<\/code><\/p>\n<p><strong>\u0418\u0442\u043e\u0433:<\/strong><\/p>\n<p>\u041f\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0443, \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430\u00a0<\/p>\n<p><code>local\\App\\Domains\\&lt;Name&gt;\\NameService.php<\/code><\/p>\n<p><code>local\\App\\Domains\\&lt;Name&gt;\\&lt;SubDir&gt;\\SubDirClass.php<\/code><\/p>\n<p><code>local\\App\\Infrastructure\\Services\\&lt;Name&gt;\\NameService.php<\/code><\/p>\n<p><code>local\\App\\Infrastructure\\Services\\&lt;Name&gt;\\&lt;SubDir&gt;\\SubDirClass.php<\/code><\/p>\n<p><code>local\\App\\Shared\\Services\\&lt;Name&gt;\\NameService.php<\/code><\/p>\n<p><code>local\\App\\Shared\\Services\\&lt;Name&gt;\\&lt;SubDir&gt;\\SubDirClass.php<\/code><\/p>\n<p>\u0418 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 \u043d\u0430 \u043b\u044e\u0431\u0443\u044e \u0433\u043b\u0443\u0431\u0438\u043d\u0443, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443:<\/p>\n<p><code>App\\Shared\\Services\\ManagementService::create()-&gt;filesystem()-&gt;modules()-&gt;psr()-&gt;actions()-&gt;registerSplByMask(mask: $mask, baseDir : 'local')<\/code><\/p>\n<p>\u041f\u043b\u044e\u0441, \u043f\u0435\u0440\u0435\u043d\u043e\u0441 \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c\u0438 \u043f\u0430\u043f\u043a\u0438 Infrastructure \u0438 Shared \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u044d\u0442\u0438\u0445 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0439.<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/448\/99f\/44d\/44899f44d89ee3ef54d233d4b90ca9ce.png\" width=\"392\" height=\"791\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/448\/99f\/44d\/44899f44d89ee3ef54d233d4b90ca9ce.png\"\/><\/figure>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/869428\/\"> https:\/\/habr.com\/ru\/articles\/869428\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e \u0432\u0441\u0435\u0445 \u043d\u0435\u0440\u0430\u0432\u043d\u043e\u0434\u0443\u0448\u043d\u044b\u0445! \u042f \u044f\u0432\u043b\u044f\u044e\u0441\u044c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u0435\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 DD Planet, \u0438 \u0441\u0435\u0433\u043e\u0434\u043d\u044f, \u043d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e, \u0434\u043e\u0448\u043b\u0438 \u0440\u0443\u043a\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438<\/p>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/824946\/\" target=\"_blank\" rel=\"noopener noreferrer nofollow\" class=\"embed_link embed_layout-right\"><\/p>\n<div class=\"embed__thumb\" style=\"background-image: url(&quot;https:\/\/habr.com\/share\/publication\/824946\/32c412d65aa03013a0639a49a887f1bc\/&quot;);\"><\/div>\n<div class=\"embed__caption\">\n<div class=\"embed__caption-title\"><span>\u0411\u0438\u0442\u0440\u0438\u043a\u0441: \u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u043a \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c<\/span><\/div>\n<div class=\"embed__caption-description\">\u041f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e \u0432\u0441\u0435\u0445 \u043d\u0435 \u0440\u0430\u0432\u043d\u043e\u0434\u0443\u0448\u043d\u044b\u0445! \u0425\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441 \u0432\u0430\u043c\u0438 \u0438\u0441\u0442\u043e\u0440\u0438\u0435\u0439 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043c\u044b \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043b\u0438 \u043a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a&#8230;<\/div>\n<p><span class=\"embed__caption-host\">habr.com<\/span><\/div>\n<p><\/a><\/p>\n<p>\u0412\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e DDD \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043c\u0435\u043d\u044b, \u0432\u044b\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044e \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c DI-\u043f\u043e\u0434\u0445\u043e\u0434.<\/p>\n<p>\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u044c \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 \u043d\u0430 DDD, \u0438 \u043f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u043c\u044b \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u0438\u043c\u0435\u043d \u0432 \u0444\u0430\u0439\u043b\u0435 init.php.<\/p>\n<figure class=\"full-width\"><\/figure>\n<p><strong>\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u043a\u043e\u043f\u043d\u0435\u043c \u0432 \u044d\u0442\u043e\u043c \u043c\u043e\u043c\u0435\u043d\u0442\u0435 \u043f\u043e\u0433\u043b\u0443\u0431\u0436\u0435!<\/strong><\/p>\n<p>\u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 DDD, \u044f \u043d\u0438 \u0438\u0437\u0443\u0447\u0430\u043b, \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0441\u044f \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u0442\u0435\u043e\u0440\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0432\u0441\u0435 \u0437\u043d\u0430\u0435\u043c, \u043d\u043e \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430 \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0432\u043e\u044f, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443:<\/p>\n<p><strong>1 \u0432\u0430\u0440\u0438\u0430\u043d\u0442. <\/strong>\u0410\u0432\u0442\u043e\u0440 \u0434\u0435\u043b\u0430\u0435\u0442 \u0434\u043e\u043c\u0435\u043d\u043d\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443, \u043e\u0442\u0434\u0435\u043b\u044f\u044f \u044f\u0434\u0440\u043e \u0438 \u043e\u0431\u0449\u0438\u0435 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443.<\/p>\n<figure class=\"\"><\/figure>\n<p><strong>2 \u0432\u0430\u0440\u0438\u0430\u043d\u0442.<\/strong> \u0410\u0432\u0442\u043e\u0440 \u0432\u044b\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u0432\u0441\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u044f \u043d\u0430 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043f\u0435\u0440\u0432\u044b\u0439 \u0441\u043b\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c \u0438\u0437 \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0435\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0439.<\/p>\n<figure class=\"full-width\"><\/figure>\n<p> \u00a0 \u00a0 <\/p>\n<p><strong>3 \u0432\u0430\u0440\u0438\u0430\u043d\u0442. <\/strong>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043d\u0430 \u0444\u0438\u0447\u0430\u0445, \u0433\u0434\u0435 \u043a\u0430\u0436\u0434\u0430\u044f \u0444\u0438\u0447\u0430 \u0436\u0438\u0432\u0451\u0442 \u0441\u0432\u043e\u0435\u0439 \u0436\u0438\u0437\u043d\u044c\u044e \u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u044b\u0435 \u043d\u0430\u0431\u043e\u0440\u044b, \u2014 \u0442\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0445\u043e\u0440\u043e\u0448 \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u0438\u043b\u0438\u0432\u0430\u043d\u0438\u044f \u043d\u0430 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u044b.<\/p>\n<figure class=\"full-width\"><\/figure>\n<p><em>\u0421\u0441\u044b\u043b\u043a\u0438 \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <\/em><\/p>\n<div class=\"embed_link\">\n<div class=\"embed__thumb\" style=\"background-image: url(&quot;https:\/\/opengraph.githubassets.com\/181847bbe0e50eb0d69993b1dfc7554098d80db0fcbc5ceaa22270a2f074d30e\/franzose\/symfony-ddd-wishlist&quot;);\"><\/div>\n<div class=\"embed__caption\">\n<div class=\"embed__caption-title\"><span>symfony-ddd-wishlist\/src at master \u00b7 franzose\/symfony-ddd-wishlist<\/span><\/div>\n<p><a href=\"https:\/\/github.com\/franzose\/symfony-ddd-wishlist\/tree\/master\/src\" target=\"_blank\" rel=\"noopener noreferrer nofollow\" class=\"embed__caption-host\">github.com<\/a><\/div>\n<\/div>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/334126\/\" target=\"_blank\" rel=\"noopener noreferrer nofollow\" class=\"embed_link embed_layout-right\"><\/p>\n<div class=\"embed__thumb\" style=\"background-image: url(&quot;https:\/\/habr.com\/share\/publication\/334126\/a41381ebe596d750819b6dd1bbc6f84d\/&quot;);\"><\/div>\n<div class=\"embed__caption\">\n<div class=\"embed__caption-title\"><span>Domain Driven Design \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435<\/span><\/div>\n<div class=\"embed__caption-description\">\u042d\u0432\u0430\u043d\u0441 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0445\u043e\u0440\u043e\u0448\u0443\u044e \u043a\u043d\u0438\u0436\u043a\u0443 \u0441 \u0445\u043e\u0440\u043e\u0448\u0438\u043c\u0438 \u0438\u0434\u0435\u044f\u043c\u0438. \u041d\u043e \u044d\u0442\u0438\u043c \u0438\u0434\u0435\u044f\u043c \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043e\u0441\u043d\u043e\u0432\u044b. \u041e\u043f&#8230;<\/div>\n<p><span class=\"embed__caption-host\">habr.com<\/span><\/div>\n<p><\/a><a href=\"https:\/\/habr.com\/ru\/articles\/718916\/\" target=\"_blank\" rel=\"noopener noreferrer nofollow\" class=\"embed_link embed_layout-right\"><\/p>\n<div class=\"embed__thumb\" style=\"background-image: url(&quot;https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2a7\/0e5\/cd6\/2a70e5cd6f32c6734dd928af18fe696c.png&quot;);\"><\/div>\n<div class=\"embed__caption\">\n<div class=\"embed__caption-title\"><span>Clean Architecture, DDD, \u0433\u0435\u043a\u0441\u0430\u0433\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430. \u0420\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u043c \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 blog \u043d\u0430 Symfony<\/span><\/div>\n<div class=\"embed__caption-description\">\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442! \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \ud83d\ude09 \u042f \u0410\u043d\u044f, \u0438 \u044f php \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u0442\u0435\u043a &#8212; Magento. \u0421 \u043d\u0435\u0434\u0430\u0432\u043d\u0438\u0445 &#8230;<\/div>\n<p><span class=\"embed__caption-host\">habr.com<\/span><\/div>\n<p><\/a><\/p>\n<p>\u041f\u043e \u0438\u0442\u043e\u0433\u0443 \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0430 \u0441\u043b\u043e\u0438 \u0435\u0441\u0442\u044c, \u0430 \u0432\u043e\u0442 \u0432 \u043a\u0430\u043a\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u2014 \u044d\u0442\u043e \u043d\u0435 \u0441\u0442\u043e\u043b\u044c \u0432\u0430\u0436\u043d\u043e. \u0422\u0443\u0442 \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043f\u0440\u0438\u043c\u0435\u0440, \u0433\u0434\u0435 \u0432 \u043e\u0434\u043d\u043e\u043c \u0434\u043e\u043c\u0435\u043d\u0435 \u0441\u043e\u0431\u0440\u0430\u043d\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u0432\u0441\u0435, \u0438 \u044d\u0442\u043e, \u043d\u0430\u0434\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u0442\u044c, \u0442\u0430 \u0436\u0435 \u0441\u0430\u043c\u0430\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430, \u043a\u0430\u043a \u0438 \u0432 \u043f\u0443\u043d\u043a\u0442\u0435 3 \u0432\u044b\u0448\u0435:<\/p>\n<figure class=\"\"><\/figure>\n<p>\u041a\u0430\u043a\u043e\u0439 \u043d\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u0432\u043e\u0434? \u041d\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439 \u0441\u0445\u0435\u043c\u044b \u2014 \u0435\u0441\u0442\u044c \u043b\u0438\u0448\u044c \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044f, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043d\u0430 \u043b\u043e\u0433\u0438\u043a\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0430\u0448\u0443 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443\u00a0<\/p>\n<blockquote>\n<p>local<\/p>\n<p>App<br \/> \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <u>Application <\/u>\u2014<u> \u0441\u0430\u043c \u0411\u0438\u0442\u0440\u0438\u043a\u0441 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u044d\u0442\u0438\u043c \u0441\u043b\u043e\u0435\u043c. \u041d\u0430\u043c \u043e\u043d \u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f.<\/u><\/p>\n<p>Domains \u2014 \u0441\u044e\u0434\u0430 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c \u043b\u043e\u0433\u0438\u043a\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p>Infrastructure \u2014 \u0442\u0443\u0442 \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0443\u0442 \u043b\u0435\u0436\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0439.<\/p>\n<p>Shared (Lib) \u2014 \u0442\u0443\u0442 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441\u044b, \u043e\u0431\u0449\u0438\u0435 \u043a\u0430\u043a \u0434\u043b\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0442\u0430\u043a \u0438 \u043b\u0435\u0433\u043a\u043e \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u044b\u0435 \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b, \u0438 \u0432\u0441\u044f\u043a\u0438\u0435 \u0445\u0435\u043b\u043f\u0435\u0440\u044b, \u043d\u0435 \u0437\u0430\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0443.<\/p>\n<\/blockquote>\n<p><strong>\u0421\u0435\u0440\u0432\u0438\u0441\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434:<\/strong><\/p>\n<p>\u0414\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0438 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043e\u043a \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u0438 \u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438, \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044f \u0441\u0432\u043e\u044e \u0444\u0430\u043d\u0442\u0430\u0437\u0438\u044e \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u043d\u043e \u043d\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044f\u0441\u044c \u0432 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u0445.<\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0440\u0430\u0437\u043d\u044b\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e:<\/p>\n<p><code>Layer\\ServiceName\\ServiceNameService::create($serviceId)-&gt;module()-&gt;methods()<\/code><\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:\u00a0<\/p>\n<p><code>App\\Domains\\Order\\OrderService::create()-&gt;repository()-&gt;getElementById($id);<\/code><\/p>\n<p><code>App\\Infrastructure\\Http\\HttpService::create(HTTPEnums::GUZZLE-&gt;value)-&gt;client()-&gt;send(array $body, Url $url)<\/code><\/p>\n<p><strong>\u041f\u0440\u0430\u043a\u0442\u0438\u043a\u0430<\/strong><\/p>\n<p><strong>1.\u00a0 <\/strong>\u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0441\u043c\u0435\u0440\u0434\u0436\u0438\u043c \u043d\u0430\u0448 composer.json \u0432 \u043f\u0430\u043f\u043a\u0435 local \u0441 \u0442\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443 \u043d\u0430\u0441 \u0432 \u044f\u0434\u0440\u0435, \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 merge-plugin, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043b\u0435\u0437\u0442\u044c \u0432 \u043f\u0430\u043f\u043a\u0443 bitrix \u0441 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0430\u043c\u0438.<\/p>\n<pre><code class=\"json\">{  \u00a0\"version\": \"1.0.0\",  \u00a0\"name\": \"name\",  \u00a0\"description\": \"description\",  \u00a0\"authors\": [  \u00a0\u00a0\u00a0{  \u00a0\u00a0\u00a0\u00a0\u00a0\"name\": \"name\",  \u00a0\u00a0\u00a0\u00a0\u00a0\"email\": \"email\"  \u00a0\u00a0\u00a0}  \u00a0],  \u00a0\"extra\": {  \u00a0\u00a0\u00a0\"installer-paths\": {  \u00a0\u00a0\u00a0\u00a0\u00a0\"modules\/{$name}\/\": [  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"type:bitrix-module\"  \u00a0\u00a0\u00a0\u00a0\u00a0]  \u00a0\u00a0\u00a0},  \u00a0\u00a0\u00a0\"merge-plugin\": {  \u00a0\u00a0\u00a0\u00a0\u00a0\"require\": [  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"..\/bitrix\/composer-bx.json\"  \u00a0\u00a0\u00a0\u00a0\u00a0]  \u00a0\u00a0\u00a0}  \u00a0},  \u00a0\"require\": {  \u00a0\u00a0\u00a0\"php\": \"&gt;=8.2\",  \u00a0\u00a0\u00a0\"psr\/container\": \"2.0\",  \u00a0\u00a0\u00a0\"psr\/http-client\": \"^1.0\",  \u00a0\u00a0\u00a0\"psr\/http-message\": \"^1.0\",  \u00a0\u00a0\u00a0\"psr\/log\": \"^3.0\",  \u00a0\u00a0\u00a0\"...\": \"...\",  \u00a0},  \u00a0\"config\": {  \u00a0\u00a0\u00a0\"vendor-dir\": \"..\/bitrix\/vendor\",  \u00a0\u00a0\u00a0\"allow-plugins\": {  \u00a0\u00a0\u00a0\u00a0\u00a0\"composer\/installers\": true,  \u00a0\u00a0\u00a0\u00a0\u00a0\"php-http\/discovery\": true  \u00a0\u00a0\u00a0}  \u00a0},  \u00a0\"require-dev\": {  \u00a0\u00a0\u00a0\"phpunit\/phpunit\": \"11.3.0\"  \u00a0},  \u00a0\"scripts\": {  \u00a0\u00a0\u00a0\"test\": \"phpunit\"  \u00a0}  }<\/code><\/pre>\n<p>\u0417\u0430\u0442\u0435\u043c \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0448\u0443 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0432\u0435\u043d\u0434\u043e\u0440\u043e\u0432 \u0432 \u0444\u0430\u0439\u043b\u0435 init.php, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e PSR-4:<\/p>\n<pre><code class=\"php\">use Bitrix\\Main\\Application;  use Bitrix\\Main\\Loader;  require(Application::getDocumentRoot() . \"\/bitrix\/vendor\/autoload.php\");  \/*****  * \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432.  *****\/  try {  \u00a0\u00a0\u00a0Loader::registerNamespace(  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"App\",  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Loader::getDocumentRoot() . \"\/local\/App\"  \u00a0\u00a0\u00a0);  } catch (LoaderException $e) {  LoggerFacade::app()-&gt;error('Error include namespace: ' . $e-&gt;getMessage());  throw new \\Exception($e-&gt;getMessage());  }<\/code><\/pre>\n<p><strong>\u0421\u043b\u043e\u0439 \u0434\u043e\u043c\u0435\u043d\u0430:<\/strong> \u0442\u0443\u0442 \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u043e\u043c\u0435\u043d \u0431\u0443\u0434\u0435\u0442 \u044f\u0432\u043b\u044f\u0442\u044c \u0438\u0437 \u0441\u0435\u0431\u044f \u043f\u043e\u043b\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0435\u043c\u0443 \u0434\u043b\u044f \u0436\u0438\u0437\u043d\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u0447\u0442\u043e\u0431\u044b \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043b\u0435\u0433\u043a\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u0440\u0430\u0441\u043f\u0438\u043b \u043d\u0430 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u044b.<\/p>\n<figure class=\"\"><\/figure>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u0434\u043e\u043c\u0435\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441, \u0434\u043b\u044f \u0435\u0434\u0438\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u044f\u043c\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0438\u0434\u0435\u0442 \u0447\u0435\u0440\u0435\u0437 \u043f\u0430\u0442\u0442\u0435\u0440\u043d <strong>&#171;\u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u0430\u044f \u0444\u0430\u0431\u0440\u0438\u043a\u0430&#187;<\/strong>, \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u043f\u0430\u0442\u0442\u0435\u0440\u043d <strong>&#171;\u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0444\u0430\u0431\u0440\u0438\u043a\u0430&#187;<\/strong> \u0438 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0441\u0430\u043c \u0441\u0435\u0431\u044f.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0434\u043e\u043c\u0435\u043d\u0430:<\/p>\n<pre><code class=\"php\">&lt;?php  namespace App\\Domains\\Contracts;  interface BaseServiceInterface  {  \u00a0\u00a0\u00a0\/**  \u00a0\u00a0\u00a0\u00a0* Method create service by key.  \u00a0\u00a0\u00a0\u00a0* @return mixed  \u00a0\u00a0\u00a0\u00a0*\/  \u00a0\u00a0\u00a0public static function create(): self;<\/code><\/pre>\n<p><\/p>\n<p>\u0418 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u043a\u043b\u0430\u0441\u0441\u0443:<\/p>\n<pre><code class=\"php\">&lt;?php  namespace App\\Domains\\Order\\Services;  use App\\Domains\\Contracts\\BaseServiceInterface;  use App\\Domains\\Order\\Services\\Exchange\\ExchangeService;  use App\\Domains\\Order\\Services\\Repository\\OrderRepository;  use App\\Shared\\DI\\Container;  use Bitrix\\Main\\ArgumentException;  readonly class OrderService implements BaseServiceInterface  {  \u00a0\u00a0\u00a0\/**  \u00a0\u00a0\u00a0\u00a0* @throws ArgumentException  \u00a0\u00a0\u00a0\u00a0*\/  \u00a0\u00a0\u00a0public static function create(): self  \u00a0\u00a0\u00a0{  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return (new Container())-&gt;get(self::class);  \u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0public function __construct(  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0private OrderRepository $repository,  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0private ExchangeService $exchangeService  \u00a0\u00a0\u00a0)  \u00a0\u00a0\u00a0{  \u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0public function repository(): OrderRepository  \u00a0\u00a0\u00a0{  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return $this-&gt;repository;  \u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0public function exchange(): ExchangeService  \u00a0\u00a0\u00a0{  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return $this-&gt;exchangeService;  \u00a0\u00a0\u00a0}  }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u0441\u0435\u0440\u0432\u0438\u0441\u0443 \u0438 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0432 \u043d\u0435\u0433\u043e \u0432\u043d\u0435\u0434\u0440\u0438\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 \u043f\u0430\u0442\u0442\u0435\u0440\u043d DI<\/p>\n<pre><code class=\"php\">public function __construct(  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0private OrderRepository $repository,  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0private ExchangeService $exchangeService  \u00a0\u00a0\u00a0)<\/code><\/pre>\n<p>\u0422\u0430\u043a, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043c\u0435\u0442\u043e\u0434\u0443 \u043f\u043e \u043f\u0443\u0442\u0438 <code>OrderService::create()-&gt;repository()-&gt;getDealRepositoryByDealId($id);<\/code><\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041d\u043e \u0435\u0441\u043b\u0438 \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u0438, \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 create() \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a\u043e\u0439-\u0442\u043e Container()? \u0422\u0430\u043a \u0432\u043e\u0442, \u0435\u0441\u043b\u0438 \u043c\u044b \u0432\u0435\u0440\u043d\u0435\u043c DI-\u0438\u043d\u044a\u0435\u043a\u0446\u0438\u044e \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u0442\u043e \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0438 \u043d\u0430\u043c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u0432\u0441\u0435\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438, \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435, \u0447\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043a\u0440\u043e\u043f\u043e\u0442\u043b\u0438\u0432\u043e.<\/p>\n<p><code>return new self(new OrderRepository(), new ExchangeService());<\/code><\/p>\n<p>\u0415\u0441\u043b\u0438 \u0431\u0440\u0430\u0442\u044c symfony \u0438 laravel, \u0442\u043e \u0442\u0430\u043c \u044d\u0442\u043e \u0440\u0435\u0448\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0445\u0435\u043b\u043f\u0435\u0440\u043e\u0432 app(). \u0412\u043e\u0442 \u0432\u044b\u0434\u0435\u0440\u0436\u043a\u0430 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0439:<\/p>\n<blockquote>\n<p>If you are using it as in your example &#8212; you&#8217;ll get no profit. But Laravel container gives much more power in this resolving that you cannot achieve with simple instantiating objects.<\/p>\n<ol>\n<li>\n<p><strong>Binding Interface<\/strong> &#8212; you can bind specific interface and it&#8217;s implementation into container and resolve it as interface. This is useful for test-friendly code and flexibility &#8212; cause you can easily change implementation in one place without changing interface. (For example use some Countable interface everywhere as a target to resolve from container but receive it&#8217;s implementation instead.)<\/p>\n<\/li>\n<li>\n<p><strong>Dependency Injection<\/strong> &#8212; if you will bind class\/interface and ask it as a dependecy in some method\/constructor &#8212; Laravel will automatically insert it from container for you.<\/p>\n<\/li>\n<li>\n<p><strong>Conditional Binding<\/strong> &#8212; you can bind interface but depending on the situation resolve different implementations.<\/p>\n<\/li>\n<li>\n<p><strong>Singleton<\/strong> &#8212; you can bind some shared instance of an object.<\/p>\n<\/li>\n<li>\n<p><strong>Resolving Event<\/strong> &#8212; each time container resolves smth &#8212; it raises an event you can subscribe in other places of your project.<\/p>\n<\/li>\n<\/ol>\n<p>And many other practises&#8230; You can read more detailed here <a href=\"http:\/\/laravel.com\/docs\/5.1\/container\" rel=\"noopener noreferrer nofollow\"><u>http:\/\/laravel.com\/docs\/5.1\/container<\/u><\/a><\/p>\n<\/blockquote>\n<p>\u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u043c \u0432\u0435\u0440\u043d\u0435\u0442 \u0438\u043d\u0441\u0442\u0430\u043d\u0441 \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438:<\/p>\n<pre><code class=\"php\">&lt;?php  namespace App\\Shared\\DI;  use Bitrix\\Main\\ArgumentException;  use Exception;  use Psr\\Container\\ContainerExceptionInterface;  use Psr\\Container\\ContainerInterface;  use Psr\\Container\\NotFoundExceptionInterface;  use ReflectionClass;  use ReflectionException;  \/**  * \u041a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432.  * @package App\\Shared\\DI  *\/  class Container implements ContainerInterface  {  \u00a0\u00a0\u00a0private array $objects = [];  \u00a0\u00a0\u00a0\/**  \u00a0\u00a0\u00a0\u00a0* @inheritDoc  \u00a0\u00a0\u00a0\u00a0*\/  \u00a0\u00a0\u00a0public function has(string $id): bool  \u00a0\u00a0\u00a0{  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return isset($this-&gt;objects[$id]) || class_exists($id);  \u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0\/**  \u00a0\u00a0\u00a0\u00a0* \u041c\u0435\u0442\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0438\u043d\u0441\u0442\u0430\u043d\u0441 \u043a\u043b\u0430\u0441\u0441\u0430 \u043f\u043e \u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0443.  \u00a0\u00a0\u00a0\u00a0*  \u00a0\u00a0\u00a0\u00a0* @param string $id  \u00a0\u00a0\u00a0\u00a0* @return mixed  \u00a0\u00a0\u00a0\u00a0* @throws ArgumentException  \u00a0\u00a0\u00a0\u00a0*\/  \u00a0\u00a0\u00a0public function get(string $id): mixed  \u00a0\u00a0\u00a0{  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0try {  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0isset($this-&gt;objects[$id])  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0? $this-&gt;objects[$id]() \u00a0 \u00a0 \u00a0 \u00a0 \/\/ \"\u0421\u0442\u0430\u0440\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434\"  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0: $this-&gt;prepareObject($id); \/\/ \"\u041d\u043e\u0432\u044b\u0439\" \u043f\u043e\u0434\u0445\u043e\u0434  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0} catch (ContainerExceptionInterface|NotFoundExceptionInterface|Exception $exception) {  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0throw new ArgumentException($exception-&gt;getMessage());  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0\/**  \u00a0\u00a0\u00a0\u00a0* @throws Exception  \u00a0\u00a0\u00a0\u00a0*\/  \u00a0\u00a0\u00a0private function prepareObject(string $class): object  \u00a0\u00a0\u00a0{  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0try {  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$classReflector = new ReflectionClass($class);  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0440\u0435\u0444\u043b\u0435\u043a\u0442\u043e\u0440 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 \u043a\u043b\u0430\u0441\u0441\u0430, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c - \u0435\u0441\u0442\u044c \u043b\u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ \u0415\u0441\u043b\u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 \u043d\u0435\u0442 - \u0441\u0440\u0430\u0437\u0443 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$constructReflector = $classReflector-&gt;getConstructor();  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if (empty($constructReflector)) {  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return new $class;  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0440\u0435\u0444\u043b\u0435\u043a\u0442\u043e\u0440\u044b \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ \u0415\u0441\u043b\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0435\u0442 - \u0441\u0440\u0430\u0437\u0443 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$constructArguments = $constructReflector-&gt;getParameters();<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-443143","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/443143","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=443143"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/443143\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=443143"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=443143"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=443143"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}