{"id":455123,"date":"2025-04-08T03:01:42","date_gmt":"2025-04-08T03:01:42","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=455123"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=455123","title":{"rendered":"<span>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0432 Laravel. \u041a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u0434 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c \u0438 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u044b\u043c<\/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>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u0442\u0435\u043c\u0435, \u0433\u0434\u0435 \u043d\u0435\u0442 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439, \u043d\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438 \u2014\u00a0<strong>\u043a\u0430\u043a \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u0432 Laravel, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u043e\u0441\u0442\u0430\u0432\u0430\u043b\u0441\u044f \u0447\u0438\u0441\u0442\u044b\u043c \u0434\u0430\u0436\u0435 \u0441\u043f\u0443\u0441\u0442\u044f \u0433\u043e\u0434\u044b \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044f<\/strong>.<\/p>\n<p>\u042f \u0440\u0430\u0437\u0431\u0435\u0440\u0443:<\/p>\n<ul>\n<li>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 Laravel \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u00ab\u0441\u0432\u0430\u043b\u043a\u0443 \u043a\u043e\u0434\u0430\u00bb.<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u043a \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c\u00a0<strong>\u0442\u043e\u043b\u0441\u0442\u044b\u0445 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432<\/strong>\u00a0\u0438\u00a0<strong>\u0431\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439<\/strong>.<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u043a\u0438\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u044b\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0434\u043b\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0440\u0430\u0437\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0430.<\/p>\n<\/li>\n<\/ul>\n<p>\u0411\u0443\u0434\u0443 \u0440\u0430\u0434 \u0434\u0438\u0441\u043a\u0443\u0441\u0441\u0438\u0438 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u2014 \u0434\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u0441\u0432\u043e\u0438\u043c \u043e\u043f\u044b\u0442\u043e\u043c, \u0433\u0434\u0435 \u044f \u043d\u0435 \u043f\u0440\u0430\u0432 \u0438\u043b\u0438 \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c!<\/p>\n<h3>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b Laravel<\/h3>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435: \u0432\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0447\u0430\u043b\u0438 \u0438\u0437\u0443\u0447\u0430\u0442\u044c Laravel \u0438 \u043f\u0438\u0448\u0435\u0442\u0435 \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442. \u041b\u043e\u0433\u0438\u043a\u0430 \u2014 \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u0445 \u0438\u043b\u0438 \u043f\u0440\u044f\u043c\u043e \u0432 \u0440\u043e\u0443\u0442\u0430\u0445, \u0430 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u043e\u0431\u0440\u0430\u0441\u0442\u0430\u044e\u0442 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u0432\u0440\u043e\u0434\u0435\u00a0sendEmailAndUpdateStatistics().\u00a0<strong>\u041a\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043d\u043e&#8230;<\/strong><\/p>\n<h4>\u0427\u0442\u043e \u043d\u0435 \u0442\u0430\u043a \u0441 \u044d\u0442\u0438\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c?<\/h4>\n<ol>\n<li>\n<p><strong>\u041d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0435 SRP (Single Responsibility Principle)<\/strong><br \/>\u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0434\u043e\u043b\u0436\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e:<\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u0438\u043d\u044f\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441.<\/p>\n<\/li>\n<li>\n<p>\u0412\u0435\u0440\u043d\u0443\u0442\u044c \u043e\u0442\u0432\u0435\u0442.<br \/>\u0412\u0441\u0451! \u041d\u043e \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u00a0<strong>\u0432\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u043e\u0447\u0442\u043e\u0432\u044b\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0438 \u043f\u0438\u0448\u0435\u0442 \u0432 \u0411\u0414<\/strong>\u00a0\u2014 \u044d\u0442\u043e \u0443\u0436\u0435 5+ \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u0432 \u043e\u0434\u043d\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f<\/strong><br \/>\u0417\u0430\u043f\u0440\u043e\u0441\u00a0User::where(&#8216;is_active&#8217;, true)-&gt;get()\u00a0\u0432 15 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u0445? \u041f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u043b\u043e\u0433\u0438\u043a\u0438 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u0440\u0430\u0432\u0438\u0442\u044c\u00a0<strong>\u0432\u0441\u0435 15 \u043c\u0435\u0441\u0442<\/strong>.<\/p>\n<\/li>\n<li>\n<p><strong>\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u0430\u0434<\/strong><br \/>\u041a\u0430\u043a \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439:<\/p>\n<ul>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u0442 \u0437\u0430\u043a\u0430\u0437.<\/p>\n<\/li>\n<li>\n<p>\u041c\u0435\u043d\u044f\u0435\u0442 \u0431\u0430\u043b\u0430\u043d\u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 3 \u0442\u0438\u043f\u0430 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0439?<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u041c\u043e\u0434\u0435\u043b\u0438 \u2014 \u043d\u0435 \u0441\u0432\u0430\u043b\u043a\u0430 \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432<\/strong><br \/>\u041a\u043e\u0433\u0434\u0430 \u0432\u00a0User.php\u00a0\u0436\u0438\u0432\u0443\u0442\u00a0payInvoice(),\u00a0banWithReason()\u00a0\u0438\u00a0generateReport(), \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435\u00a0<strong>\u043a\u043b\u0430\u0441\u0441 \u043d\u0430 2000 \u0441\u0442\u0440\u043e\u043a<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c.<\/p>\n<\/li>\n<\/ol>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u044b, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e\u0433\u043e \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c!<\/p>\n<h2>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u044b \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0432 Laravel.<\/h2>\n<p><strong>Action<\/strong> &#8212; \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d, \u043a\u0443\u0434\u0430 \u043c\u044b \u0432\u044b\u043d\u043e\u0441\u0438\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0438<\/p>\n<pre><code class=\"php\">class FilterDataForInsertAction {      public function execute(OrderDTO $data): array   {     \/\/ \u0412\u0430\u0448\u0430 \u043b\u043e\u0433\u0438\u043a\u0430   }    }<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0438\u0445 \u044d\u043a\u0448\u0435\u043d\u043e\u0432 \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e, \u043d\u043e \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u044d\u043a\u0448\u0435\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0434\u0440\u0443\u0433\u0438\u0435.<\/p>\n<p>\u041a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u0438\u043c\u0435\u0435\u0442 \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u0438\u043d \u043c\u0435\u0442\u043e\u0434 execute (\u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c __invoke), \u0433\u0434\u0435 \u043c\u044b \u043f\u0438\u0448\u0435\u043c \u043b\u043e\u0433\u0438\u043a\u0443 \u0441\u0442\u0440\u043e\u0433\u043e \u043f\u043e \u0435\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438. \u0418 \u0437\u0434\u0435\u0441\u044c \u0436\u0435 \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u0445 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 OrderDTO.<\/p>\n<p><strong>DTO<\/strong> &#8212; Data Transfer Object, \u0431\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u0441\u043b\u043e\u044f\u043c\u0438 \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041d\u0435 \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0443, \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043e\u043d \u043d\u0443\u0436\u0435\u043d \u043a\u0430\u043a \u0440\u0430\u0437 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 Service Layer, Action, Repository \u0438 \u0442.\u0434.<\/p>\n<pre><code class=\"php\">class OrderDTO {        public readonly int $id;     public readonly string $name;     public readonly string $description;     public readonly string $phone;          public function __construct(int $id, string $name, string $description, string $phone)      {         $this-&gt;id = $id;         $this-&gt;name = $name;         $this-&gt;description = $description;         $this-&gt;phone = $phone;     } }<\/code><\/pre>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e \u0432 DTO \u043d\u0435 \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u043a\u0443\u044e-\u043b\u0438\u0431\u043e \u0431\u0438\u0437\u043d\u0435\u0441 \u043b\u043e\u0433\u0438\u043a\u0443. \u041a\u043b\u0430\u0441\u0441 DTO \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c.<\/p>\n<p><strong>Repository <\/strong>&#8212; \u044d\u0442\u043e \u043a\u043b\u0430\u0441\u0441, \u043a\u0443\u0434\u0430 \u043c\u044b \u0432\u044b\u043d\u043e\u0441\u0438\u043c \u043a\u0430\u043a\u0443\u044e-\u043b\u0438\u0431\u043e \u043b\u043e\u0433\u0438\u043a\u0443 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445. \u0427\u0430\u0449\u0435 \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u0433\u0434\u0435 \u0435\u0441\u0442\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0441\u043c\u0435\u043d\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<pre><code class=\"php\">class OrderRepository implements OrderRepositoryInterface {    public function getAll(): Collection   {     return Order::with()       -&gt;where()       -&gt;groupBy()           -&gt;having()       -&gt;get()   }    }<\/code><\/pre>\n<pre><code class=\"php\">interface OrderRepositoryInterface {   public function getAll(): Collection  }<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0432\u0430\u0436\u043d\u043e \u043f\u043e\u0434\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043c\u044b \u0437\u0430\u0432\u0438\u0441\u0438\u043c \u043e\u0442 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438 \u0432 \u0432\u0438\u0434\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u0430 \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 Laravel \u0435\u0441\u0442\u044c DI \u0438 Service Provider:<\/p>\n<pre><code class=\"php\">class AppServiceProvider extends ServiceProvider { const BINDINGS  = [ OrderRepositoryInterface::class =&gt; OrderRepository::class, TaskRepositoryInterface::class =&gt; TaskRepository::class ];      public function register(): void     {     foreach (self::BINDINGS as $abstract =&gt; $concrete) {     $this-&gt;app-&gt;bind($abstract, $concrete);     }     }  }<\/code><\/pre>\n<p>\u041b\u0443\u0447\u0448\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438, \u0433\u0434\u0435 \u043c\u044b \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u043c \u0438\u043c\u0435\u043d\u043d\u043e \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0437\u0430\u0433\u0440\u044f\u0437\u043d\u044f\u0442\u044c AppServiceProvider.<\/p>\n<p>\u0412 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435: <\/p>\n<pre><code class=\"php\">public function OrderController extends Controller {      private OrderRepositoryInterface $orderRepository;    public function __construct(OrderRepositoryInterface $orderRepository) { $this-&gt;orderRepository = $orderRepository; }    public function index(): OrderResource   {     return OrderResource::collection($this-&gt;orderRepository-&gt;getAll())   } }<\/code><\/pre>\n<p><strong>Service Layer<\/strong> \u2014 \u044d\u0442\u043e \u043e\u0431\u043e\u044e\u0434\u043e\u043e\u0441\u0442\u0440\u044b\u0439 \u043c\u0435\u0447 \u0432 Laravel-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435. \u041c\u043d\u043e\u0433\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u044f\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0438\u0437 \u0442\u043e\u043b\u0441\u0442\u044b\u0445 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u0432 \u0442\u043e\u043b\u0441\u0442\u044b\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u044f \u043d\u043e\u0432\u044b\u0435 &#171;\u0431\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b&#187;.<\/p>\n<h3>\u0413\u043b\u0430\u0432\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430<\/h3>\n<pre><code class=\"php\">class DoEverythingService {     \/\/ 500 \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0435\u043b\u0430\u044e\u0442:     \/\/ - \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0411\u0414     \/\/ - \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 \u043f\u0438\u0441\u0435\u043c     \/\/ - API-\u0437\u0430\u043f\u0440\u043e\u0441\u044b     \/\/ - \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u043e\u0442\u0447\u0435\u0442\u043e\u0432 }<\/code><\/pre>\n<p>\u0422\u0430\u043a\u043e\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0430\u0440\u0443\u0448\u0430\u0435\u0442 \u0432\u0441\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b SOLID \u0438 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 &#171;\u043c\u0443\u0441\u043e\u0440\u043d\u044b\u0439 \u0431\u0430\u043a&#187; \u0434\u043b\u044f \u043a\u043e\u0434\u0430.<\/p>\n<h3>\u041a\u0430\u043a \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c?<\/h3>\n<ol>\n<li>\n<p><strong>\u041e\u0434\u0438\u043d \u0441\u0435\u0440\u0432\u0438\u0441 \u2014 \u043e\u0434\u043d\u0430 \u0437\u043e\u043d\u0430 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438<\/strong><\/p>\n<ul>\n<li>\n<p>OrderService\u00a0\u2014 \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0437\u0430\u043a\u0430\u0437\u0430\u043c\u0438<\/p>\n<\/li>\n<li>\n<p>PaymentService\u00a0\u2014 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043b\u0430\u0442\u0435\u0436\u0438<\/p>\n<\/li>\n<li>\n<p>NotificationService\u00a0\u2014 \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0421\u0435\u0440\u0432\u0438\u0441 \u2014 \u044d\u0442\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043e\u0440, \u0430 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c<\/strong><\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"php\">class OrderService {       public function __construct(         private readonly CreateOrderAction $createOrder,         private readonly CreatePaymentForOrderAction $createPayment,         private readonly OrderNotifierInterface $notifier,     ) {}      public function createOrder(OrderDTO $data): Order     {         $order = $this-&gt;createOrder-&gt;execute($data);         $this-&gt;createPayment-&gt;execute($order);         $this-&gt;notifier-&gt;send($order);         return $order;     } }<\/code><\/pre>\n<h2>\u041d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0451? \u041a\u043e\u0434 \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0439?<\/h2>\n<p>\u0414\u0430\u0436\u0435 \u043f\u0440\u0438 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u043e\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0438 \u0432\u0441\u0435\u0445 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u0432 Laravel \u0438\u043c\u0435\u0435\u0442 \u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u0443\u044e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u0443\u044e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u2014\u00a0<strong>\u043a\u043e\u0434 \u043e\u0434\u043d\u043e\u0439 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0431\u0440\u043e\u0441\u0430\u043d \u043f\u043e \u0434\u0435\u0441\u044f\u0442\u043a\u0430\u043c \u043f\u0430\u043f\u043e\u043a<\/strong>. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438:<\/p>\n<h3>\u0422\u0438\u043f\u0438\u0447\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 Laravel<\/h3>\n<pre><code>app\/ \u251c\u2500\u2500 Http\/ \u2502   \u2514\u2500\u2500 Controllers\/ \u2502       \u2514\u2500\u2500 UserController.php \u251c\u2500\u2500 Models\/ \u2502   \u2514\u2500\u2500 User.php \u251c\u2500\u2500 Jobs\/ \u2502   \u2514\u2500\u2500 SendWelcomeEmail.php \u251c\u2500\u2500 Console\/ \u2502   \u2514\u2500\u2500 Commands\/ \u2502       \u2514\u2500\u2500 DeleteInactiveUsers.php \u251c\u2500\u2500 Events\/ \u2502   \u251c\u2500\u2500 UserRegistered.php \u2502   \u2514\u2500\u2500 UserDeleted.php \u2514\u2500\u2500 Listeners\/     \u251c\u2500\u2500 SendVerificationEmail.php     \u2514\u2500\u2500 UpdateUserStatistics.php<\/code><\/pre>\n<p><strong>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430:<\/strong><\/p>\n<ol>\n<li>\n<p><strong>\u041f\u043e\u0442\u0435\u0440\u044f \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430<\/strong><br \/>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c \u0432\u0441\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438, \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u044b\u0433\u0430\u0442\u044c \u043c\u0435\u0436\u0434\u0443 7+ \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f\u0445<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0430<\/strong><br \/>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f \u0432 \u043c\u043e\u0434\u0435\u043b\u0438\u00a0User\u00a0\u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0432\u0441\u0435\u0445 \u043c\u0435\u0441\u0442, \u0433\u0434\u0435 \u043e\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u2014 \u0430 \u044d\u0442\u043e \u043c\u0438\u043d\u0438\u043c\u0443\u043c 5-10 \u0444\u0430\u0439\u043b\u043e\u0432<\/p>\n<\/li>\n<li>\n<p><strong>\u0414\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439<\/strong><br \/>\u041e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0438\u043d\u0436\u0435\u043a\u0442\u044f\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b, jobs \u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b<\/p>\n<\/li>\n<\/ol>\n<p>\u0414\u043b\u044f \u0438\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u0435 \u0442\u0430\u043a\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u0432 Laravel \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043b\u0438 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u0443\u044e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443. \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0439:<\/p>\n<pre><code>\u2514\u2500\u2500 Users\/     \u251c\u2500\u2500 Actions\/     \u2502   \u251c\u2500\u2500 CreateUserAction.php     \u2502   \u2514\u2500\u2500 DeleteUserAction.php     \u251c\u2500\u2500 Data\/     \u2502   \u2514\u2500\u2500 UserDataDTO.php     \u251c\u2500\u2500 Events\/     \u251c\u2500\u2500 Listeners\/     \u251c\u2500\u2500 Models\/     \u2502   \u2514\u2500\u2500 User.php     \u251c\u2500\u2500 Jobs\/     \u2502   \u2514\u2500\u2500 SendWelcomeEmail.php     \u2514\u2500\u2500 Controllers\/         \u2514\u2500\u2500 UserController.php<\/code><\/pre>\n<p>\u041f\u043e\u0434\u043e\u0431\u043d\u0443\u044e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 \u043c\u043e\u0436\u043d\u043e \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c \u0438 \u0441\u0430\u043c\u043e\u043c\u0443, \u043d\u043e \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f. \u0421\u0430\u043c\u043e\u0435 \u043a\u043b\u0430\u0441\u0441\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0441\u0435\u0431\u044f \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043a\u0430\u043a \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u0430\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 (\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0434\u0440\u0443\u0433\u043e\u0439 \u043d\u0435\u0439\u043c\u0438\u043d\u0433), \u044d\u0442\u043e Porto (apiato)  <a href=\"https:\/\/github.com\/apiato\/apiato\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/apiato\/apiato<\/a>. \u0420\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0439 \u0435\u0433\u043e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435 \u0437\u0434\u0435\u0441\u044c \u044f \u0443\u0436\u0435 \u043d\u0435 \u0431\u0443\u0434\u0443, \u044d\u0442\u043e \u0437\u0430\u0439\u043c\u0451\u0442 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0436\u0435\u043b\u0430\u044e \u0432\u0430\u043c \u0441\u0430\u043c\u0438\u043c \u0432 \u043d\u0451\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f!<\/p>\n<h2>\u0421\u043b\u043e\u0436\u043d\u0430\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 &#8212; \u043d\u0435 \u043f\u0430\u043d\u0430\u0446\u0435\u044f.<\/h2>\n<p>\u0412\u0430\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b \u044d\u0442\u043e \u043b\u0438\u0448\u044c \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438, \u0430 \u043d\u0435 \u0437\u0430\u043a\u043e\u043d\u044b. \u0415\u0441\u043b\u0438 \u0434\u0435\u0434\u043b\u0430\u0439\u043d\u044b \u0433\u043e\u0440\u044f\u0442, \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0435\u043a\u0442 \u0432\u0447\u0435\u0440\u0430, \u0438\u043b\u0438 \u044d\u0442\u043e \u043f\u0440\u043e\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0438\u043a\u0430\u043a \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c\u0441\u044f  &#8212; \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0441 \u0433\u043e\u043b\u043e\u0432\u043e\u0439 \u0443\u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u044b\u0435 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u044b. \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e CRUD \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u0443\u044e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 &#8212; \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u0430\u044f \u0442\u0440\u0430\u0442\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435 \u043e YAGNI &#8212; \u043d\u0435 \u0434\u0435\u043b\u0430\u0439\u0442\u0435 \u0442\u043e\u0433\u043e, \u043e \u0447\u0451\u043c \u0432\u0430\u0441 \u043d\u0435 \u043f\u0440\u043e\u0441\u044f\u0442. (\u044d\u0442\u043e \u043d\u0435 \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0437\u0430\u0434\u0430\u043d\u0438\u0439, \u0433\u0434\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0435\u0441\u044c \u0432\u0430\u0448 \u0441\u043a\u0438\u043b\u043b). <\/p>\n<p>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u044b\u0445 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u0435\u043b\u0438\u043a\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u2014 \u043e\u0442 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 Actions \u0434\u043e \u0441\u043b\u043e\u0436\u043d\u044b\u0445 CQRS \u0438 Event Sourcing \u0441\u0438\u0441\u0442\u0435\u043c \u0438 \u0432\u0435\u043b\u0438\u043a\u043e\u0433\u043e \u0438 \u0443\u0436\u0430\u0441\u043d\u043e\u0433\u043e DDD. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438 \u043b\u0438\u0448\u044c \u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u0432 \u043e\u0431\u043e\u0437\u0440\u0435\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u043a\u043b\u044e\u0447\u0435. \u042d\u0442\u043e \u043d\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430\u043c, \u044f \u043b\u0438\u0448\u044c \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 Laravel, \u0447\u0442\u043e\u0431\u044b \u0432\u044b \u043c\u043e\u0433\u043b\u0438 \u0443\u0433\u043b\u0443\u0431\u0438\u0442\u044c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435 \u0441\u0430\u043c\u0438!<\/p>\n<p>\u0414\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u0441\u0432\u043e\u0438\u043c\u0438 \u043d\u0430\u0445\u043e\u0434\u043a\u0430\u043c\u0438 \u0441 \u043a\u043e\u043b\u043b\u0435\u0433\u0430\u043c\u0438, \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u0439\u0442\u0435 \u0432 code review, \u0431\u0443\u0434\u044c\u0442\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u044b \u043a \u043d\u043e\u0432\u043e\u043c\u0443. \u0418\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a \u0440\u043e\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u043e-\u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u043c\u0443 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434. \u0412\u0441\u0435\u043c \u0441\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435!<\/p>\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\/898584\/\"> https:\/\/habr.com\/ru\/articles\/898584\/<\/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>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u0442\u0435\u043c\u0435, \u0433\u0434\u0435 \u043d\u0435\u0442 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439, \u043d\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438 \u2014\u00a0<strong>\u043a\u0430\u043a \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u0432 Laravel, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u043e\u0441\u0442\u0430\u0432\u0430\u043b\u0441\u044f \u0447\u0438\u0441\u0442\u044b\u043c \u0434\u0430\u0436\u0435 \u0441\u043f\u0443\u0441\u0442\u044f \u0433\u043e\u0434\u044b \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044f<\/strong>.<\/p>\n<p>\u042f \u0440\u0430\u0437\u0431\u0435\u0440\u0443:<\/p>\n<ul>\n<li>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 Laravel \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u00ab\u0441\u0432\u0430\u043b\u043a\u0443 \u043a\u043e\u0434\u0430\u00bb.<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u043a \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c\u00a0<strong>\u0442\u043e\u043b\u0441\u0442\u044b\u0445 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432<\/strong>\u00a0\u0438\u00a0<strong>\u0431\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439<\/strong>.<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u043a\u0438\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u044b\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0434\u043b\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0440\u0430\u0437\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0430.<\/p>\n<\/li>\n<\/ul>\n<p>\u0411\u0443\u0434\u0443 \u0440\u0430\u0434 \u0434\u0438\u0441\u043a\u0443\u0441\u0441\u0438\u0438 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u2014 \u0434\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u0441\u0432\u043e\u0438\u043c \u043e\u043f\u044b\u0442\u043e\u043c, \u0433\u0434\u0435 \u044f \u043d\u0435 \u043f\u0440\u0430\u0432 \u0438\u043b\u0438 \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c!<\/p>\n<h3>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b Laravel<\/h3>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435: \u0432\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0447\u0430\u043b\u0438 \u0438\u0437\u0443\u0447\u0430\u0442\u044c Laravel \u0438 \u043f\u0438\u0448\u0435\u0442\u0435 \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442. \u041b\u043e\u0433\u0438\u043a\u0430 \u2014 \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u0445 \u0438\u043b\u0438 \u043f\u0440\u044f\u043c\u043e \u0432 \u0440\u043e\u0443\u0442\u0430\u0445, \u0430 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u043e\u0431\u0440\u0430\u0441\u0442\u0430\u044e\u0442 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u0432\u0440\u043e\u0434\u0435\u00a0sendEmailAndUpdateStatistics().\u00a0<strong>\u041a\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043d\u043e&#8230;<\/strong><\/p>\n<h4>\u0427\u0442\u043e \u043d\u0435 \u0442\u0430\u043a \u0441 \u044d\u0442\u0438\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c?<\/h4>\n<ol>\n<li>\n<p><strong>\u041d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0435 SRP (Single Responsibility Principle)<\/strong><br \/>\u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0434\u043e\u043b\u0436\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e:<\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u0438\u043d\u044f\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441.<\/p>\n<\/li>\n<li>\n<p>\u0412\u0435\u0440\u043d\u0443\u0442\u044c \u043e\u0442\u0432\u0435\u0442.<br \/>\u0412\u0441\u0451! \u041d\u043e \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u00a0<strong>\u0432\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u043e\u0447\u0442\u043e\u0432\u044b\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0438 \u043f\u0438\u0448\u0435\u0442 \u0432 \u0411\u0414<\/strong>\u00a0\u2014 \u044d\u0442\u043e \u0443\u0436\u0435 5+ \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u0432 \u043e\u0434\u043d\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f<\/strong><br \/>\u0417\u0430\u043f\u0440\u043e\u0441\u00a0User::where(&#8216;is_active&#8217;, true)-&gt;get()\u00a0\u0432 15 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u0445? \u041f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u043b\u043e\u0433\u0438\u043a\u0438 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u0440\u0430\u0432\u0438\u0442\u044c\u00a0<strong>\u0432\u0441\u0435 15 \u043c\u0435\u0441\u0442<\/strong>.<\/p>\n<\/li>\n<li>\n<p><strong>\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u0430\u0434<\/strong><br \/>\u041a\u0430\u043a \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439:<\/p>\n<ul>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u0442 \u0437\u0430\u043a\u0430\u0437.<\/p>\n<\/li>\n<li>\n<p>\u041c\u0435\u043d\u044f\u0435\u0442 \u0431\u0430\u043b\u0430\u043d\u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 3 \u0442\u0438\u043f\u0430 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0439?<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u041c\u043e\u0434\u0435\u043b\u0438 \u2014 \u043d\u0435 \u0441\u0432\u0430\u043b\u043a\u0430 \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432<\/strong><br \/>\u041a\u043e\u0433\u0434\u0430 \u0432\u00a0User.php\u00a0\u0436\u0438\u0432\u0443\u0442\u00a0payInvoice(),\u00a0banWithReason()\u00a0\u0438\u00a0generateReport(), \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435\u00a0<strong>\u043a\u043b\u0430\u0441\u0441 \u043d\u0430 2000 \u0441\u0442\u0440\u043e\u043a<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c.<\/p>\n<\/li>\n<\/ol>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u044b, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e\u0433\u043e \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c!<\/p>\n<h2>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u044b \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0432 Laravel.<\/h2>\n<p><strong>Action<\/strong> &#8212; \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d, \u043a\u0443\u0434\u0430 \u043c\u044b \u0432\u044b\u043d\u043e\u0441\u0438\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0438<\/p>\n<pre><code class=\"php\">class FilterDataForInsertAction {      public function execute(OrderDTO $data): array   {     \/\/ \u0412\u0430\u0448\u0430 \u043b\u043e\u0433\u0438\u043a\u0430   }    }<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0438\u0445 \u044d\u043a\u0448\u0435\u043d\u043e\u0432 \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e, \u043d\u043e \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u044d\u043a\u0448\u0435\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0434\u0440\u0443\u0433\u0438\u0435.<\/p>\n<p>\u041a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u0438\u043c\u0435\u0435\u0442 \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u0438\u043d \u043c\u0435\u0442\u043e\u0434 execute (\u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c __invoke), \u0433\u0434\u0435 \u043c\u044b \u043f\u0438\u0448\u0435\u043c \u043b\u043e\u0433\u0438\u043a\u0443 \u0441\u0442\u0440\u043e\u0433\u043e \u043f\u043e \u0435\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438. \u0418 \u0437\u0434\u0435\u0441\u044c \u0436\u0435 \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u0445 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 OrderDTO.<\/p>\n<p><strong>DTO<\/strong> &#8212; Data Transfer Object, \u0431\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u0441\u043b\u043e\u044f\u043c\u0438 \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041d\u0435 \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0443, \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043e\u043d \u043d\u0443\u0436\u0435\u043d \u043a\u0430\u043a \u0440\u0430\u0437 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 Service Layer, Action, Repository \u0438 \u0442.\u0434.<\/p>\n<pre><code class=\"php\">class OrderDTO {        public readonly int $id;     public readonly string $name;     public readonly string $description;     public readonly string $phone;          public function __construct(int $id, string $name, string $description, string $phone)      {         $this-&gt;id = $id;         $this-&gt;name = $name;         $this-&gt;description = $description;         $this-&gt;phone = $phone;     } }<\/code><\/pre>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e \u0432 DTO \u043d\u0435 \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u043a\u0443\u044e-\u043b\u0438\u0431\u043e \u0431\u0438\u0437\u043d\u0435\u0441 \u043b\u043e\u0433\u0438\u043a\u0443. \u041a\u043b\u0430\u0441\u0441 DTO \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c.<\/p>\n<p><strong>Repository <\/strong>&#8212; \u044d\u0442\u043e \u043a\u043b\u0430\u0441\u0441, \u043a\u0443\u0434\u0430 \u043c\u044b \u0432\u044b\u043d\u043e\u0441\u0438\u043c \u043a\u0430\u043a\u0443\u044e-\u043b\u0438\u0431\u043e \u043b\u043e\u0433\u0438\u043a\u0443 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445. \u0427\u0430\u0449\u0435 \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u0433\u0434\u0435 \u0435\u0441\u0442\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0441\u043c\u0435\u043d\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<pre><code class=\"php\">class OrderRepository implements OrderRepositoryInterface {    public function getAll(): Collection   {     return Order::with()       -&gt;where()       -&gt;groupBy()           -&gt;having()       -&gt;get()   }    }<\/code><\/pre>\n<pre><code class=\"php\">interface OrderRepositoryInterface {   public function getAll(): Collection  }<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0432\u0430\u0436\u043d\u043e \u043f\u043e\u0434\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043c\u044b \u0437\u0430\u0432\u0438\u0441\u0438\u043c \u043e\u0442 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438 \u0432 \u0432\u0438\u0434\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u0430 \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 Laravel \u0435\u0441\u0442\u044c DI \u0438 Service Provider:<\/p>\n<pre><code class=\"php\">class AppServiceProvider extends ServiceProvider { const BINDINGS  = [ OrderRepositoryInterface::class =&gt; OrderRepository::class, TaskRepositoryInterface::class =&gt; TaskRepository::class ];      public function register(): void     {     foreach (self::BINDINGS as $abstract =&gt; $concrete) {     $this-&gt;app-&gt;bind($abstract, $concrete);     }     }  }<\/code><\/pre>\n<p>\u041b\u0443\u0447\u0448\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438, \u0433\u0434\u0435 \u043c\u044b \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u043c \u0438\u043c\u0435\u043d\u043d\u043e \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0437\u0430\u0433\u0440\u044f\u0437\u043d\u044f\u0442\u044c AppServiceProvider.<\/p>\n<p>\u0412 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435: <\/p>\n<pre><code class=\"php\">public function OrderController extends Controller {      private OrderRepositoryInterface $orderRepository;    public function __construct(OrderRepositoryInterface $orderRepository) { $this-&gt;orderRepository = $orderRepository; }    public function index(): OrderResource   {     return OrderResource::collection($this-&gt;orderRepository-&gt;getAll())   } }<\/code><\/pre>\n<p><strong>Service Layer<\/strong> \u2014 \u044d\u0442\u043e \u043e\u0431\u043e\u044e\u0434\u043e\u043e\u0441\u0442\u0440\u044b\u0439 \u043c\u0435\u0447 \u0432 Laravel-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435. \u041c\u043d\u043e\u0433\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u044f\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0438\u0437 \u0442\u043e\u043b\u0441\u0442\u044b\u0445 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u0432 \u0442\u043e\u043b\u0441\u0442\u044b\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u044f \u043d\u043e\u0432\u044b\u0435 &#171;\u0431\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b&#187;.<\/p>\n<h3>\u0413\u043b\u0430\u0432\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430<\/h3>\n<pre><code class=\"php\">class DoEverythingService {     \/\/ 500 \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0435\u043b\u0430\u044e\u0442:     \/\/ - \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0411\u0414     \/\/ - \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 \u043f\u0438\u0441\u0435\u043c     \/\/ - API-\u0437\u0430\u043f\u0440\u043e\u0441\u044b     \/\/ - \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u043e\u0442\u0447\u0435\u0442\u043e\u0432 }<\/code><\/pre>\n<p>\u0422\u0430\u043a\u043e\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0430\u0440\u0443\u0448\u0430\u0435\u0442 \u0432\u0441\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b SOLID \u0438 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 &#171;\u043c\u0443\u0441\u043e\u0440\u043d\u044b\u0439 \u0431\u0430\u043a&#187; \u0434\u043b\u044f \u043a\u043e\u0434\u0430.<\/p>\n<h3>\u041a\u0430\u043a \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c?<\/h3>\n<ol>\n<li>\n<p><strong>\u041e\u0434\u0438\u043d \u0441\u0435\u0440\u0432\u0438\u0441 \u2014 \u043e\u0434\u043d\u0430 \u0437\u043e\u043d\u0430 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438<\/strong><\/p>\n<ul>\n<li>\n<p>OrderService\u00a0\u2014 \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0437\u0430\u043a\u0430\u0437\u0430\u043c\u0438<\/p>\n<\/li>\n<li>\n<p>PaymentService\u00a0\u2014 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043b\u0430\u0442\u0435\u0436\u0438<\/p>\n<\/li>\n<li>\n<p>NotificationService\u00a0\u2014 \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0421\u0435\u0440\u0432\u0438\u0441 \u2014 \u044d\u0442\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043e\u0440, \u0430 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c<\/strong><\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"php\">class OrderService {       public function __construct(         private readonly CreateOrderAction $createOrder,         private readonly CreatePaymentForOrderAction $createPayment,         private readonly OrderNotifierInterface $notifier,     ) {}      public function createOrder(OrderDTO $data): Order     {         $order = $this-&gt;createOrder-&gt;execute($data);         $this-&gt;createPayment-&gt;execute($order);         $this-&gt;notifier-&gt;send($order);         return $order;     } }<\/code><\/pre>\n<h2>\u041d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0451? \u041a\u043e\u0434 \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0439?<\/h2>\n<p>\u0414\u0430\u0436\u0435 \u043f\u0440\u0438 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u043e\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0438 \u0432\u0441\u0435\u0445 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u0432 Laravel \u0438\u043c\u0435\u0435\u0442 \u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u0443\u044e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u0443\u044e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u2014\u00a0<strong>\u043a\u043e\u0434 \u043e\u0434\u043d\u043e\u0439 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0431\u0440\u043e\u0441\u0430\u043d \u043f\u043e \u0434\u0435\u0441\u044f\u0442\u043a\u0430\u043c \u043f\u0430\u043f\u043e\u043a<\/strong>. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438:<\/p>\n<h3>\u0422\u0438\u043f\u0438\u0447\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 Laravel<\/h3>\n<pre><code>app\/ \u251c\u2500\u2500 Http\/ \u2502   \u2514\u2500\u2500 Controllers\/ \u2502       \u2514\u2500\u2500 UserController.php \u251c\u2500\u2500 Models\/ \u2502   \u2514\u2500\u2500 User.php \u251c\u2500\u2500 Jobs\/ \u2502   \u2514\u2500\u2500 SendWelcomeEmail.php \u251c\u2500\u2500 Console\/ \u2502   \u2514\u2500\u2500 Commands\/ \u2502       \u2514\u2500\u2500 DeleteInactiveUsers.php \u251c\u2500\u2500 Events\/ \u2502   \u251c\u2500\u2500 UserRegistered.php \u2502   \u2514\u2500\u2500 UserDeleted.php \u2514\u2500\u2500 Listeners\/     \u251c\u2500\u2500 SendVerificationEmail.php     \u2514\u2500\u2500 UpdateUserStatistics.php<\/code><\/pre>\n<p><strong>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430:<\/strong><\/p>\n<ol>\n<li>\n<p><strong>\u041f\u043e\u0442\u0435\u0440\u044f \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430<\/strong><br \/>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c \u0432\u0441\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438, \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u044b\u0433\u0430\u0442\u044c \u043c\u0435\u0436\u0434\u0443 7+ \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f\u0445<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0430<\/strong><br \/>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f \u0432 \u043c\u043e\u0434\u0435\u043b\u0438\u00a0User\u00a0\u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0432\u0441\u0435\u0445 \u043c\u0435\u0441\u0442, \u0433\u0434\u0435 \u043e\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u2014 \u0430 \u044d\u0442\u043e \u043c\u0438\u043d\u0438\u043c\u0443\u043c 5-10 \u0444\u0430\u0439\u043b\u043e\u0432<\/p>\n<\/li>\n<li>\n<p><strong>\u0414\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439<\/strong><br \/>\u041e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0438\u043d\u0436\u0435\u043a\u0442\u044f\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b, jobs \u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b<\/p>\n<\/li>\n<\/ol>\n<p>\u0414\u043b\u044f \u0438\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u0435 \u0442\u0430\u043a\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u0432 Laravel \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043b\u0438 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u0443\u044e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443. \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0439:<\/p>\n<pre><code>\u2514\u2500\u2500 Users\/     \u251c\u2500\u2500 Actions\/     \u2502   \u251c\u2500\u2500 CreateUserAction.php     \u2502   \u2514\u2500\u2500 DeleteUserAction.php     \u251c\u2500\u2500 Data\/     \u2502   \u2514\u2500\u2500 UserDataDTO.php     \u251c\u2500\u2500 Events\/     \u251c\u2500\u2500 Listeners\/     \u251c\u2500\u2500 Models\/     \u2502   \u2514\u2500\u2500 User.php     \u251c\u2500\u2500 Jobs\/     \u2502   \u2514\u2500\u2500 SendWelcomeEmail.php     \u2514\u2500\u2500 Controllers\/         \u2514\u2500\u2500 UserController.php<\/code><\/pre>\n<p>\u041f\u043e\u0434\u043e\u0431\u043d\u0443\u044e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 \u043c\u043e\u0436\u043d\u043e \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c \u0438 \u0441\u0430\u043c\u043e\u043c\u0443, \u043d\u043e \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f. \u0421\u0430\u043c\u043e\u0435 \u043a\u043b\u0430\u0441\u0441\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0441\u0435\u0431\u044f \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043a\u0430\u043a \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u0430\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 (\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0434\u0440\u0443\u0433\u043e\u0439 \u043d\u0435\u0439\u043c\u0438\u043d\u0433), \u044d\u0442\u043e Porto (apiato)  <a href=\"https:\/\/github.com\/apiato\/apiato\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/apiato\/apiato<\/a>. \u0420\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0439 \u0435\u0433\u043e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435 \u0437\u0434\u0435\u0441\u044c \u044f \u0443\u0436\u0435 \u043d\u0435 \u0431\u0443\u0434\u0443, \u044d\u0442\u043e \u0437\u0430\u0439\u043c\u0451\u0442 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0436\u0435\u043b\u0430\u044e \u0432\u0430\u043c \u0441\u0430\u043c\u0438\u043c \u0432 \u043d\u0451\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f!<\/p>\n<h2>\u0421\u043b\u043e\u0436\u043d\u0430\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 &#8212; \u043d\u0435 \u043f\u0430\u043d\u0430\u0446\u0435\u044f.<\/h2>\n<p>\u0412\u0430\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b \u044d\u0442\u043e \u043b\u0438\u0448\u044c \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438, \u0430 \u043d\u0435 \u0437\u0430\u043a\u043e\u043d\u044b. \u0415\u0441\u043b\u0438 \u0434\u0435\u0434\u043b\u0430\u0439\u043d\u044b \u0433\u043e\u0440\u044f\u0442, \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0435\u043a\u0442 \u0432\u0447\u0435\u0440\u0430, \u0438\u043b\u0438 \u044d\u0442\u043e \u043f\u0440\u043e\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0438\u043a\u0430\u043a \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c\u0441\u044f  &#8212; \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0441 \u0433\u043e\u043b\u043e\u0432\u043e\u0439 \u0443\u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u044b\u0435 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u044b. \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e CRUD \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u0443\u044e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 &#8212; \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u0430\u044f \u0442\u0440\u0430\u0442\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435 \u043e YAGNI &#8212; \u043d\u0435 \u0434\u0435\u043b\u0430\u0439\u0442\u0435 \u0442\u043e\u0433\u043e, \u043e \u0447\u0451\u043c \u0432\u0430\u0441 \u043d\u0435 \u043f\u0440\u043e\u0441\u044f\u0442. (\u044d\u0442\u043e \u043d\u0435 \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0437\u0430\u0434\u0430\u043d\u0438\u0439, \u0433\u0434\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0435\u0441\u044c \u0432\u0430\u0448 \u0441\u043a\u0438\u043b\u043b). <\/p>\n<p>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u044b\u0445 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u0435\u043b\u0438\u043a\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u2014 \u043e\u0442 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 Actions \u0434\u043e \u0441\u043b\u043e\u0436\u043d\u044b\u0445 CQRS \u0438 Event Sourcing \u0441\u0438\u0441\u0442\u0435\u043c \u0438 \u0432\u0435\u043b\u0438\u043a\u043e\u0433\u043e \u0438 \u0443\u0436\u0430\u0441\u043d\u043e\u0433\u043e DDD. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438 \u043b\u0438\u0448\u044c \u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u0432 \u043e\u0431\u043e\u0437\u0440\u0435\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u043a\u043b\u044e\u0447\u0435. \u042d\u0442\u043e \u043d\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430\u043c, \u044f \u043b\u0438\u0448\u044c \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 Laravel, \u0447\u0442\u043e\u0431\u044b \u0432\u044b \u043c\u043e\u0433\u043b\u0438 \u0443\u0433\u043b\u0443\u0431\u0438\u0442\u044c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435 \u0441\u0430\u043c\u0438!<\/p>\n<p>\u0414\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u0441\u0432\u043e\u0438\u043c\u0438 \u043d\u0430\u0445\u043e\u0434\u043a\u0430\u043c\u0438 \u0441 \u043a\u043e\u043b\u043b\u0435\u0433\u0430\u043c\u0438, \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u0439\u0442\u0435 \u0432 code review, \u0431\u0443\u0434\u044c\u0442\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u044b \u043a \u043d\u043e\u0432\u043e\u043c\u0443. \u0418\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a \u0440\u043e\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u043e-\u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u043c\u0443 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434. \u0412\u0441\u0435\u043c \u0441\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435!<\/p>\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\/898584\/\"> https:\/\/habr.com\/ru\/articles\/898584\/<\/a><br \/><\/br><\/br><\/p>\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-455123","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/455123","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=455123"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/455123\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=455123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=455123"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=455123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}